PHP: move_uploaded_file partially uploading -


I am using the following code and uploading it to upload a CSV to my server. Occasionally (and very randomly), the uploaded file only contains half the original file of half the file (the original file contains 450 rows, but some of my uploads contain only ~ 200 rows). Move_file_upload () is returning true, and it is happening before the CSV is processed. Any idea or idea why? Yes, the permissions are all correct.

  // PHP: Public function import () (if ($ this- & amp; Request-> ('Post')) {$ destination = "./uploaded_csvs/ Reports / ".pair ()." _ "$ This-> request> data ['report'] ['file'] ['name']; // copy the report to server if (move_uploaded_file $ This- & gt; Request- & gt; Data ['report'] ['file'] ['tmp_name'], $ destination)) {// success - process csv} Else {// error}}} // HTML: Lieutenant; Form Acceptable-Charset = "UTF-8" method = "Post" encrypt = "Multipart / Form-date "Id =" reportform "action =" / report / import ">  input type =" file "id =" report file "size =" 7 "value =" "name =" data [report] [file ]  
Input type = "image" src = "/ img / buttons / save.png" & gt; & gt; & gt; & gt; P>

move_upload_file will not leave a file. Anything that was uploaded will be transferred. What is getting from the server, if it is getting smaller

Always the first thing with one upload should be to know that:

  if ($ _FILES ['file'] ['error']! == UPLOAD_ERR_OK) {Dead ('Upload Error Code #' with failed. $ $ _FILES ['File'] ['Error']); }  

Do not accept success. Always check the failure, and keep the success as a pleasant surprise.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -