Hiya all,
I’m using some code that I got from the net (I forget where but all credit to the author) and adapted to suit my own needs (almost). I have an upload page with 5 file uploads which is processed by this script: (I’ve annotated where I think the problems may be)
<?php $path1= "../uploads/".$HTTP_POST_FILES['ufile']['name'][0]; $path2= "../uploads/".$HTTP_POST_FILES['ufile']['name'][1]; $path3= "../uploads/".$HTTP_POST_FILES['ufile']['name'][2]; $path4= "../uploads/".$HTTP_POST_FILES['ufile']['name'][3]; $path5= "../uploads/".$HTTP_POST_FILES['ufile']['name'][4]; copy($HTTP_POST_FILES['ufile']['tmp_name'][0], $path1); copy($HTTP_POST_FILES['ufile']['tmp_name'][1], $path2); copy($HTTP_POST_FILES['ufile']['tmp_name'][2], $path3); copy($HTTP_POST_FILES['ufile']['tmp_name'][3], $path4); copy($HTTP_POST_FILES['ufile']['tmp_name'][4], $path5); include '../includes/smile.php'; echo "It took me an entire day to get it at this level of functionality where if you sucessfully upload your files you get a success message on the same page but otherwise are redirected to a failure page.
The problem is, if you don’t upload a file for each of the 5 form inputs, you get the succes message and then redirected to the fail page.
Someone who actually knows something about php will probably see a solution straight away but I don’t and I have very little idea on how to fix this.
I considered an elseif arguement but once I’d been working on the above all day and discovered that there can be a difference between elseif and else if my head was fried. Coming back to it today I realised that I have no idea how to implement it if it were a viable solution.
I am beginning to suspect that it is my redirect method but I have no idea how to do it differently.
Please help, somebody. I don’t necessarily want it done for me, but some pointers on how to do it for myself would be great!
Thanks in advance.
Paul