php - uploading file so what should i do with headers? -


we set image uploading on our server nginx. gets posted /upload , redirects /file processing. file gets uploaded , stored, there headers @ top of file.

------webkitformboundaryquwbabts5uilhgdn

content-disposition: form-data; name="picture"; filename="coldplay.jpg"

content-type: image/jpeg

what this? strip these headers out php , save file again?

is uploading files these headers expected behavior?

here form:

<form action="/upload/"  id="upload3" method="post">     <input type="file" id="file" name="picture" value=""/>     <input type="submit" onclick="return uploadfiles(this.form);"> </form> 

and js:

<script type="text/javascript">      function uploadfiles(form) {           var formdata = new formdata(form);            var url = "/upload/";           var xhr = new xmlhttprequest();           xhr.open('post', url, true);           xhr.onload = function(e) {             if (this.status == 200) {               console.log(this.responsetext);             }           };            xhr.send(formdata);  // multipart/form-data            return false;     } </script> 

i'm using these lines of code strip first 4 lines our uploaded image files. found somewhere on , works great -- unfortunately don't know was.

$line_to_strip = 4; $new_file = new splfileobject($file_full_new, 'w'); foreach (new limititerator(new splfileobject($file_full), $line_to_strip) $line)     $new_file->fwrite($line);  

i don't know if our permanent solution, however.


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -