I recently upgraded to a dedicated hosting package and am suffering a little on the learning curve with the following script which worked previously on a shared hosting package. I think it's a problem with granting file permission. Here's the code that processes a file upload ...
if (file_exists($target_path ) == FALSE) {
$result_var = mkdir($target_path, 0777);
}
$target_name = $target_path . "/" . $file_name . ".jpg";
$target_path .= "/" . basename( $_FILES['uploadedfile'] ['name'] );
if(move_uploaded_file( $_FILES[ 'uploadedfile' ]
['tmp_name'], $target_path ) == FALSE) {
return "Error uploading file!";
}
I have no problem creating the new directory, I'm only having a problem with move_upload_file.
So basically I keep getting the "Error uploading file" errors.
Any ideas??? Also, should I be using 0777?
2007-05-18
06:01:15
·
2 answers
·
asked by
caweiten
1
in
Computers & Internet
➔ Programming & Design
The problem was related to safe mode being off. Once I changed the local and master values of safe mode, it worked.
2007-05-18
12:46:57 ·
update #1
I changed the file permission to 0755, that seems to still work, thanks!
2007-05-19
07:34:02 ·
update #2