Jump to content

pdf not uploading


pagegen

Recommended Posts

Hi guys

 

I am using the code below to upload files, image files seem to upload ok, but for some reason I cnt seem to upload pdf files.. any suggestions?

 

 

Thank you

 

<?php
ini_set('file_uploads','on'); 
ini_set('upload_max_filesize','1000M'); 
ini_set('max_execution_time', 0);



    echo "Upload: " . $_FILES["file"]["name"] . "<br />";
    echo "Type: " . $_FILES["file"]["type"] . "<br />";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
    echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";

    if (file_exists("invoices/" . $_FILES["file"]["name"]))
      {
      echo $_FILES["file"]["name"] . " already exists. ";
      }
    else
      {
      move_uploaded_file($_FILES["file"]["tmp_name"], "invoices/" . $_FILES["file"]["name"]);
      echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
      }


?>  


<form action="" method="post" enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="Submit" />
</form>

Link to comment
https://forums.phpfreaks.com/topic/209775-pdf-not-uploading/
Share on other sites

Your code has no error checking/error reporting logic in it to get it to tell you if the upload worked or failed or why it is failing.

 

You must test if $_FILES array contains anything and then you must test the $_FILES["file"]["error"] element before you attempt to access any of the uploaded file information. You are probably exceeding one of the size limits.

 

Ref: http://in2.php.net/manual/en/ini.core.php#ini.post-max-size

      http://in2.php.net/manual/en/features.file-upload.errors.php

 

Also, you cannot set file_uploads or upload_max_filesize in your script. They must be set before your script executes.

Link to comment
https://forums.phpfreaks.com/topic/209775-pdf-not-uploading/#findComment-1095050
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.