0

I created an uploader script which can upload large files because it splits it into blobs. But I figured out that using PHP's fopen and fwrite won't work for putting the parts back together again (maybe a memory thing).

I figured out that there is a unix command cat that could put it together (http://www.cyberciti.biz/faq/linux-unix-appleosx-bsd-cat-command-examples/)

But the question is: How can I select all fileparts and put it together in one PHP exec command?

I think the syntax would be kinda like this but I have no idea how to select all the parts:

exec('cat "'.$all_my_parts.'" >> "' . $original_filename.'"');
user2718671
  • 2,866
  • 9
  • 49
  • 86
  • Can you elaborate on your issues with using PHP to do it? – Flosculus Sep 19 '14 at 08:51
  • Because after the upload a batchjob is starting and everything shall be automatic. So after the last part is uploaded the restoring script is fired via ajax call. How else to do? – user2718671 Sep 19 '14 at 08:56
  • I mean the `fopen and fwrite won't work for putting the parts back together again` part. – Flosculus Sep 19 '14 at 09:08
  • I don't remember anymore. But for big files it just didn't work. Was a timeout or memory error. Then someone suggested to work with cat because that works for sure for large files. – user2718671 Sep 19 '14 at 09:15

0 Answers0