I am a little stuck, as pretty much everyone on here
I am wanting to create a image uploader that adds the user information etc to the sql, I have made the code before (and it works) on another page, but for some reason it isnât allowing it to work on this page.
I have looked over the code two or three times and canât find the error. Can anyone help please?
[php]if($_POST[âfileUploadâ] == âUploadâ) {
foreach($_POST as $key => $value) {
$data[$key] = filter($value);
}
if ($_FILES['photo'] == '') {
} else {
$prefix = substr ( md5(uniqid(rand(),1)), 3, 10)
$target = âfiles/â.$prefix."_";
$target = $target . basename($FILES[âphotoâ][ânameâ]);
$pic = ($prefix."".$_FILES[âphotoâ][ânameâ]);
if(move_uploaded_file($_FILES[âphotoâ][âtmp_nameâ], $target)) {
mysql_query (âINSERT INTO uploaded
(user_id
,username
,upload_title
,upload_name
)
VALUES (â$_SESSION[user_id]â,â$_SESSION[user_name]â,â$data[title]â,â$picâ)â);
$msg[] = âFile Sucessfully Uploaded!â;
} else { echo âError - Conact Administration Quote Code: FLERROR42â; } } }
[/php]
The Form for this code is the following:::
[php]
Upload: |
Title: |
File Type: |
Additional Information::
The file âfiles/â does exsist, the sql table âuploadedâ is also in my sql database and the sql database information is defined earlier within the code (not including for saftey)
if anyone can spot my error I would be forever grateful Thanks.