phpknight Posted August 19, 2007 Share Posted August 19, 2007 I am testing out a PEAR example. For some reason, it works just fine if I try to upload a gif, but if I use a jpg or png, the PEAR error says the file is missing. All the files are only 1KB. Anybody have this problem before? If so, how did you fix it? The form code is this: <form enctype="multipart/form-data" action="uploadtest.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="200000"/> File to upload: <input name="myFile" type="file"/> <input type="submit" name="submit" value="Upload"/> </form> PEAR code: require_once('HTTP/Upload.php'); if (isset($_POST['submit'])&& $_POST['submit']=='Upload') { $upload=new HTTP_Upload('en'); $file=$upload->getFiles('myFile'); if (PEAR::isError($file)) { die ($file->getMessage()); } if ($file->isValid()) { $uploadDirectory="/uploaddirhere/"; $file->setName('safe'); $uploadName=$file->moveTo($uploadDirectory); if (PEAR::isError($uploadName)) { die($uploadName->getMessage()); } echo 'The file <strong>'. $file->getProp('real').'</strong> has been upload to the <em>'.$uploadDirectory.'</em> directory and rename to <strong>'.$uploadName.'</strong>.'; } else { print $file->getMessage(); var_dump($_POST); } } Link to comment https://forums.phpfreaks.com/topic/65695-solved-weird-upload-problem/ Share on other sites More sharing options...
phpknight Posted August 19, 2007 Author Share Posted August 19, 2007 I figured it out. PEAR actually has a bug where it tells you the file was missing even though it really was too large. It is working now. Link to comment https://forums.phpfreaks.com/topic/65695-solved-weird-upload-problem/#findComment-328103 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.