tags:

views:

31

answers:

1

now i working with PHP: ZipArchive and there is a function calles addfilefromstr how i can upload a file and get its content from tmp then add it in archive i think file_get_content will do that? or using copy function how i can make it

+1  A: 

You should move the uploaded file using move_uploaded_file and then use ZipArchive::addFile to add it to the ZIP. The reasoning behind this is that tmp files can be difficult to read and manipulate depending on the server's configuration.

Once the file is added to the zip, you should delete the uploaded file and remove any temporary files created in the upload process.

Rowan
Delete the file the moment you're done with it, don't rely on cleanup after the fact, that way you'll never have to worry about temp space.
TravisO
@TravisO You're right, have updated to reflect
Rowan