Jump to content

Uploader errors


sinkhead

Recommended Posts

// Now we should move the uploaded file to it's temporary directory
message("Temporary directory: temp/$tempfolder/".$_FILES['uploadedfile']['name']);
if(copy($_FILES['uploadedfile']['tmp_name'], "temp/$tempfolder/".$_FILES['uploadedfile']['name'])){
  success("Uploaded file moved to temporary directory");
} else {
  cleanup("Uploaded file could not be moved to temporary directory");
}

$tempfolder - A unique 5 digit folder name

message(); - Sends output as a message (applies certain formatting etc)

cleanup(); - There has been an error so this function displays the error applying formatting. It also deletes all the temporary files and so on.

This part of the script is designed to move the uploaded file (a ZIP) to a temporary location that I can access and use the ImageMagick library on.

 

The error displayed is

Uploaded file could not be moved to temporary directory

 

I'm not very good at PHP and I followed the tutorial here

 

Please help me

- Sam

Link to comment
https://forums.phpfreaks.com/topic/50963-uploader-errors/
Share on other sites

Ok, so I've gotten a bit further with sorting out my problem. When I check the $_FILES variable using print_r() I get this:

Array ( [uploadedfile] => Array ( [name] => shinji.zip [type] => [tmp_name] => [error] => 2 [size] => 0 ) )

My file can't be moved because [tmp_name] isn't set. And I havn't got a clue why this is...

 

Can someone please shed some light on this?

- Sam

Link to comment
https://forums.phpfreaks.com/topic/50963-uploader-errors/#findComment-250759
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.