rkellermeyer Posted August 30, 2007 Share Posted August 30, 2007 Hey all, I was wondering if anyone could take a look at this script, and let me know why it won't upload the file. A rundown of what it is supposed to do: Simply upload the stores.csv file to the server. Here's the code: <?php // Receiving variables $pfw_ip= $_SERVER['REMOTE_ADDR']; $file_Name = $_FILES['file']['name']; $file_Size = $_FILES['file']['size']; $file_Temp = $_FILES['file']['tmp_name']; $file_Mime_Type = $_FILES['file']['type']; function RecursiveMkdir($path) { if (!file_exists($path)) { RecursiveMkdir(dirname($path)); mkdir($path, 0777); } } // Validation if( $file_Size == 0) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please choose the stores.csv file!</font></p>"); } if( $file_Size >3000000) { //delete file unlink($file_Temp); die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please choose the stores.csv file!</font></p>"); } if( $file_Mime_Type != "text/csv" ) { unlink($file_Temp); die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please choose the stores.csv file!</font></p>"); } $uploadFile = $file_Name ; if (!is_dir(dirname($uploadFile))) { RecursiveMkdir(dirname($uploadFile)); } else { chmod(dirname($uploadFile), 0777); } move_uploaded_file( $file_Temp , $uploadFile); chmod($uploadFile, 0644); $file_URL = "http://www.mysite.com/".$file_Name ; if (strlen($file) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please choose the stores.csv file!</font></p>"); } echo("<p align='center'><font face='Arial' size='3' color='#FF0000'>Success ... goto step #2.</font></p>"); ?> Any help would be greatly appreciated! Link to comment https://forums.phpfreaks.com/topic/67283-upload-script-seems-to-have-a-problem/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.