Ask a Question related to PHP Development, Design and Development.
-
Eric Haskins #1
unlink() in a loop???
I have a script that allows users to upload pics and enter personal info
into Database (not pictures i only store filename in db). The form passes
the pics using $_FILES['pic1'] .. pic2 and so on to pic10
I have run into a couple cases where someone messes up info on the form and
script warns them and exits. When it does this the files are already
uploaded to the respective directory. I have tried to move the upload
scripts for each file to the end of the script but when an upload fails say
on pic10 there are still 9 pics already uploaded.
Is there anyway to have the script clean up after an error to unlink the
files? Also is there any way to do this with a loop so I dont have to write
unlink($docdir.$pic1) ..2 ...3 and so on? I would also like to add this to
my admin so when a user cancels I can delete their pics along with db info
--
Eric Haskins
RackSPEED.Net
WebHosting from $4.99/month
Dedicated Servers
Multiple UpStream Providers
Eric Haskins Guest
-
Unlink and variables
Hello, I created a form to upload files. The formfield contents are stored as records in an Ascii file "data.dat"; for reasons I am not using a... -
Still need unlink help!! God help me. - Revisited
<20030808202717051099.GyazMail.neuroball@usa.net> <YW50aWdvbmU=.45ab06a65368617cf57750f9f6311818@1060402929.cotse.net> -
Still need unlink help!! God help me.
Still having problem with unlink. My original problem began with deleting files from a list. I seem to have fixed the problem reading the list but... -
Help with Unlink please
> Steve Grazzini wrote at Wed, 06 Aug 2003 23:38:00 -0400: Neither of these worked. I am beginning to think that there is something wrong with... -
problem using unlink()
Hi, I have a problem using unlink(); on a system using FreeBSD and Apache... where my local system using Windows and Apache experiences no... -
stephan beal #2
Re: unlink() in a loop???
Eric Haskins wrote:
If you do not move the uploaded files from their temporary upload path then> Is there anyway to have the script clean up after an error to unlink the
> files?
PHP will delete them automatically at the end of the request. That's what
the docs say, anyway.
[url]http://www.php.net/manual/en/features.file-upload.php[/url]
"The file will be deleted from the temporary directory at the end of the
request if it has not been moved away or renamed."
--
----- stephan beal
Registered Linux User #71917 [url]http://counter.li.org[/url]
I speak for myself, not my employer. Contents may
be hot. Slippery when wet. Reading disclaimers makes
you go blind. Writing them is worse. You have been Warned.
stephan beal Guest



Reply With Quote

