i need to mimic how an upload form work. i need to store a file into database and uploads the $_FILES into our folders. The problem every bit of code of the models and the form itself is based on legacy code. I don’t have the the gut to strip all code and start over. I prefer to let it be
So, my goal is how to uplaod file without use the previous form and then only serialize/unserialize an object consist of filename and url. while the file itself have been story via copy function and not uploads form.
The only critical part of the $_FILES array for any particular request is the
...['tmp_name']portion, since that points to where PHP saved the uploaded file. Save a copy of a $_FILES that’s set up the way you want to test (with however many files you want), then manually change the tmp_name to point to actual files on your server, rather than the random garbage names that PHP autoassigns to uploads, and you could be able to reuse a copy of the data as many times as you want, as long as your scripts don’t move/delete/munge the files you’re pointing at.So, something like:
and then you can stick a
wherever it’s appropriate for testing your app.