User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 426,810 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,924 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 530 | Replies: 5 | Solved
Reply
Join Date: Jun 2008
Posts: 7
Reputation: marcux is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
marcux marcux is offline Offline
Newbie Poster

Save/load photo no redirection

  #1  
Jul 10th, 2008
Hi all!
I have a script with a form with:
action="loadPhoto.php"
enctype = "multipart/form-data"
method="POST"
an input type=file and a submit button.
So when you click submit the php-script checks that the choosen file is a image-file and that the size isn't to big and saves it to server.
When you press the submit button, the file is uploaded, I get directed to the php-page and I redirect back to the origin page where the image is displayed.

How can I do this dynamicly??
I want to press the submit button and not get redirected to the php-page.
I just dunamicly want to "wait" on the "submit"-page and show something like "loading...", and when it is loaded, render it on screen again. All this without redirection.

Please help me!!

Marcux
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2007
Location: Arkansas
Posts: 398
Reputation: buddylee17 will become famous soon enough buddylee17 will become famous soon enough 
Rep Power: 2
Solved Threads: 78
buddylee17's Avatar
buddylee17 buddylee17 is offline Offline
Posting Whiz

Re: Save/load photo no redirection

  #2  
Jul 10th, 2008
You could do this a number of ways. The easiest, in my opinion would be Flash.
However, if Flash isn't an option, JDOMP or AJAX will do it. Both of these will require some understanding of JavaScript and the DOM. In all three however, the same basic steps occur. Variables are sent to the php script and the output of the php script is sent back as a response. The url never changes.
Reply With Quote  
Join Date: Jun 2008
Posts: 7
Reputation: marcux is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
marcux marcux is offline Offline
Newbie Poster

Re: Save/load photo no redirection

  #3  
Jul 11th, 2008
Thanks buddylee17 that was exactly what I was after.
I realy liked JDOMP it seems like a realy good way to do it.
One thing I can't see clear is when I look at the code is when I send my var to the php-script like: "...myscript.php?myvar=value"
In php: How do I get hold of myvar??
$_GET['myvar'] or is it $_POST['myvar']

Many thanks
Reply With Quote  
Join Date: Nov 2007
Location: Arkansas
Posts: 398
Reputation: buddylee17 will become famous soon enough buddylee17 will become famous soon enough 
Rep Power: 2
Solved Threads: 78
buddylee17's Avatar
buddylee17 buddylee17 is offline Offline
Posting Whiz

Re: Save/load photo no redirection

  #4  
Jul 11th, 2008
If it's in the query string (myscript.php?myvar=value), you use get:
$var=$_GET['myvar']; You can put as many variables as needed into the query string:myscript.php?myvar=value&var2=value&var3=value...
Go to google and search for something. You'll notice many variables in the url.
Reply With Quote  
Join Date: Jun 2008
Posts: 7
Reputation: marcux is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
marcux marcux is offline Offline
Newbie Poster

Re: Save/load photo no redirection

  #5  
Jul 11th, 2008
Thanks again!
The exaples you showed in your JDOMP does these url:s show up in the webbrowser?
If they are how do I make it a "POST", cos' then you will not get the url in the browser if I'm not wrong, right?
Second of all, isn't there a limit on length in the "GET" method, and not a limit in the "POST" method?
Reply With Quote  
Join Date: Nov 2007
Location: Arkansas
Posts: 398
Reputation: buddylee17 will become famous soon enough buddylee17 will become famous soon enough 
Rep Power: 2
Solved Threads: 78
buddylee17's Avatar
buddylee17 buddylee17 is offline Offline
Posting Whiz

Re: Save/load photo no redirection

  #6  
Jul 11th, 2008
No, with AJAX, JDOMP, or Flash, the url is never seen. The request is sent "behind the scenes". The user doesn't see any change in the url throughout the data exchange. Here is a simple example of how it works.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 7:55 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC