Saturday 15 August 2015

php - Warning: copy() [function.copy]: Filename cannot be empty -


I am uploading a PDF and .zip file via an HTML form, sending it to my PHP script Where the file is moved from the temporary folder and placed in a specified folder. Now it works very well on files under 2 MB, above all I get the following error message:

  WARNING: Copy () [function.copy]: File name is not empty   

The file name is not empty and the code works fine for files under the size of 2MB.

I have checked my php.ini file in / photo / file (im running centos6.4) and I understand this

  upload_max_filesize = 50m   

I am thinking that it is still a PHP config problem which generates errors on more than 2MB files, should I see any other configs?

  & lt ;? Php session_start (); $ Ref = $ _POST ['doc_ref']; $ Rev = $ _POST ['doc_rev']; $ Owner = $ _POST ['doc_owner']; $ Contract = $ _POST ['contract']; $ Cat = $ _POST ['Cat']; $ Type = $ _POST ['type']; $ Pdf = $ _FILES ['PDF']; $ Zip = $ _FILES ['zip']; $ Pdf_name = $ _FILES ['PDF'] ['name']; $ Content = $ _POST ['doc_content']; $ Userid = $ _SESSION ['users_id']; Date_default_timezone_set ('UTC'); $ Date = date_create (); // Get the PDF from the form, then delete the extension $ title = $ _FILES ["pdf"] ["name"]; $ Headline = pathanfu ($ headline, pithinfo_fifllma); $ Sth = "select 'from' contract 'where` contracts_id` =' $ contract '"; $ Result = $ conn- & gt; Query ($ sth); While ($ line = $ result-> get (PDFO: FETCH_ASSOC)) {$ contract_name = $ line ['contract_name']; $ Contract_prefix = $ line ['prefix']; } If ($ contract_prefix) {if ($ type === '1') {$ zippath = "zips /" $ Contract_prefix "/" $ Contract_name "/ form /"; $ Arcath = "arc" / "$ Contract_prefix" / "$ Contract_name" / form / "; $ Pdfpath = "pdfs /" $ Contract_prefix "/" $ Contract_name "/ form /"; } Otherwise ($ type === '2') {$ zippath = "zips /" $ Contract_prefix "/" $ Contract_name "/ Work instructions and process flow /"; $ Arcath = "arc /" $ Contract_prefix "/" $ Contract_name "/ work instructions and process flow"; $ Pdfpath = "pdfs /" $ Contract_prefix "/" $ Contract_name "/ Work Instructions and Process Flow /"; }} And {if ($ type === '1') {$ zippath = "zips /" $ Contract_name "/ form /"; $ Arcath = "arc /" $ Contract_name "/ form /"; $ Pdfpath = "pdfs /" $ Contract_name "/ form /"; } Otherwise ($ type === '2') {$ zippath = "zips /" $ Contract_name "/ work instructions and process flow /"; $ Arccith = "arc /" $ Contract_name "/ work instructions and process flow"; $ Pdfpath = "pdfs /" $ Contract_name "/ work instructions and process flow"; }} $ Pdfpath = $ pdfpath $ _FILES ["PDF"] ["name"]; $ Zippath = $ zippath $ _FILES ["zip"] ["name"]; // archpath later $ arcpathfinal = $ arppath; // arp arpath = $ arppath to add the current revision to the name of the zip files "revision" $ Rev "-" $ _FILES ["zip"] ["name"]; // Check the uploaded file in PDF format and then delete directory $ permission = array ('pdf'); $ Pdf = $ _FILES ['pdf'] ['name']; $ Ext = pathinfo ($ pdf, PATHINFO_EXTENSION); If (! In_array ($ ext, $ permission)) 'echo' file type should be a PDF! '; } And {// move zip and pdf move_uploaded_file ($ _ files ["pdf"] ["tmp_name"], $ pdfpath in the correct folder; Move_uploaded_file ($ _ files ["zip"] ["tmp_name"], $ zippath); } // Copy a copy of the zip file to the arch folder ($ zippath, $ arppath); // in the database code here   

UPDATE

OK I'm doing a little testing, $ $ _FILES array seems empty When filesyi is greater than 2 MB, below 2 MB, ARI name, type, TMP_NA, error, is expected.

What would be the reason $ $ _FILES is empty with more than 2MB files Yes, my upload_max_filesize file is set to more than size and my post_max_size is set more than my upload_max_filesize Yes, in the phache.in.in file After making changes, Apache has restarted

Allows maximum size of data. This setting also affects file uploads. To upload large files, this value should be larger than upload_max_filesize

No comments:

Post a Comment