PDA

View Full Version : redirect after php upload action.


deafboyzaudio
08-18-2009, 11:28 PM
i am trying to send my users to a thankyou.htm page after they upload some files through PHP to my server. cant get the page to change after upload. tried messin with the action but no luck. here is my from code>>>>

<form action="" method="post" enctype="multipart/form-data" name="form1" id="form1">
<input name="Browse5" type="file" id="browse" size="45" maxlength="200" />
<input name="Browse4" type="file" id="browse" size="45" maxlength="200" />
<input name="Browse3" type="file" id="browse" size="45" maxlength="200" />
<input name="Browse2" type="file" id="browse" size="45" maxlength="200" />
<input name="Browse" type="file" id="browse" size="45" maxlength="200" />
<input name="Submit" action="thankyou.htm" type="submit" id="submit" value="Upload" /></form>

im sure this is somewhere on the site but if it is, its not very easy to find. thanks for your patience... Peace

Cascade
08-19-2009, 12:32 AM
Use something like

if(isset($_POST['submit'))
{
header("Location: thankyou.html");
exit;
}else{
echo "Uploading failed.";
}

Then just make a page called thankyou.html an have it say like Thanks for uploading.

edbr
08-19-2009, 12:50 AM
it will probably be better intergrated at the end of your update script and i would use absolute as in
header("Location:http://www.your site.com/thankyou.html");

Cascade
08-19-2009, 12:52 AM
I agree with that, only reason I didn't put it like that is because I was unsure how is url worked. forgot to mention it :P

deafboyzaudio
08-19-2009, 03:54 AM
does that go in my script or in my form? where at in the form or script if so?

Cascade
08-19-2009, 05:06 AM
Just do this.

if(isset($_POST['submit'))
{
header("Location: http://yoursite.com/thankyou.html");
exit;
}else{
echo "Uploading failed.";



<form action="" method="post" enctype="multipart/form-data" name="form1" id="form1">
<input name="Browse5" type="file" id="browse" size="45" maxlength="200" />
<input name="Browse4" type="file" id="browse" size="45" maxlength="200" />
<input name="Browse3" type="file" id="browse" size="45" maxlength="200" />
<input name="Browse2" type="file" id="browse" size="45" maxlength="200" />
<input name="Browse" type="file" id="browse" size="45" maxlength="200" />
<input name="Submit" action="thankyou.htm" type="submit" id="submit" value="Upload" /></form>

deafboyzaudio
08-19-2009, 06:07 AM
Just do this.

if(isset($_POST['submit'))
{
header("Location: http://yoursite.com/thankyou.html");
exit;
}else{
echo "Uploading failed.";



<form action="" method="post" enctype="multipart/form-data" name="form1" id="form1">
<input name="Browse5" type="file" id="browse" size="45" maxlength="200" />
<input name="Browse4" type="file" id="browse" size="45" maxlength="200" />
<input name="Browse3" type="file" id="browse" size="45" maxlength="200" />
<input name="Browse2" type="file" id="browse" size="45" maxlength="200" />
<input name="Browse" type="file" id="browse" size="45" maxlength="200" />
<input name="Submit" action="thankyou.htm" type="submit" id="submit" value="Upload" /></form>

I tried doing this and it displays as text above my upload div. Tried what edbr said putting it at the end of the script and get an error like this..."Parse error: syntax error, unexpected ')', expecting ']' in /homepages/31/d280942954/htdocs/WA_DigitalFilePro/HelperPHP.php on line 1070." if this works it'll have to be put somewhere else and i dont know enough about php coding to figure it out.....

edbr
08-19-2009, 06:36 AM
yes it would because it is processing the header first.
post your upload script

deafboyzaudio
08-19-2009, 06:52 PM
here it is edbr, its a big one, thanks

Cascade
08-19-2009, 07:40 PM
Sorry bout that I must of forgot a few things lol

deafboyzaudio
08-19-2009, 08:04 PM
no worries man, happens to us all. ill just be happy when this is all done and my business is goin....:mrgreen:

Cascade
08-19-2009, 09:13 PM
Well anyway

if(isset($_POST['submit']))
{
$submit = $_POST['submit'];

header("Location: http://yoursite.com/thanks.html");
exit;
}else{
echo "Upload failed";
}
//Do your uploading here.

That should work, I've never had any issues with this when I tested it.

deafboyzaudio
08-19-2009, 11:11 PM
yea i just cant get it to work..... i have another script for a feed back form that is way simple, and the format is the same as waht you said, so im sure it works. my script for upload is about 1000 lines so i dont have a clue. i did find a spot that had a header:location thing or whatever but when i replaced that with your code, i got an error.

Cascade
08-19-2009, 11:13 PM
Did you write this code yourself?

deafboyzaudio
08-19-2009, 11:21 PM
sorry edbr i had to take my script down i got sketched out.....winderin about security. thanks anyways

deafboyzaudio
08-20-2009, 04:32 AM
no i didnt write it myself, i got it from a company called web assist. they make programs that integrate right into dreamweaver. I have digital file pro, a program that writes upload, download, rename, etc. scripts for php/mysql. it also makes cool progress bars... im not too happy with the program though as it has compatibility issues.... the progress bar screws with the template, etc.
They provide a forum with employees to answer your questions, i posted this issue up on there tonight. hopefully ill get an answer by tomorrow.
I'm sure your script works as i said it integrates into a simpler script. this one by web assist is so complicated i have no idea where to place it, im sure that all it is.

edbr
08-20-2009, 05:02 AM
there are so many free upload scripts available it would not be s difficult to get this right

Cascade
08-20-2009, 03:37 PM
I don't understand why you'd want to use such a huge upload script for something as simple as uploading

deafboyzaudio
08-20-2009, 03:45 PM
i want it to be secure, and most the free ones arent that good, or so i would think. all the free ones i have seen dont do much but upload certain file types. i mean their free, how good can they be right?

THis script not only uploads, it can resize and convert to a certain file type for storage. It makes thumbnails and also organizes everything to your liking. thats just the uploading part, the program has capability for downloading scripts and user initiated delete scripts, a cool progress bar and a few other things. i want this to work cuz i paid 100 for the program, but i am within the 15 day money back guarantee just in case....

edbr
08-21-2009, 01:14 AM
i can understand concern about security and i can also see without more knowledge you need a tailor made script.
your answer then is clear if you have paid for this you should contact them to resolve it not rely on post on this free forum.

as to free being flawed you should consider, linux, sun systems with php, mysql,open office Image magik. and more relavent, phpclasses with its huge free class repository.

Cascade
08-21-2009, 01:28 AM
You could do all that you wanted yourself. Get a good php book you can learn everything you need to know. Also you can make a secure upload with many differnt types of file upload ability. With I believe less then 1000 lines of code.

deafboyzaudio
08-21-2009, 04:36 PM
aite, well thanks for the advice guys... peace