Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What's the best method for large string transfers?

Status
Not open for further replies.

ID10T16

Technical User
Sep 22, 2000
160
US
I'm trying to find out what is the best method to transfer longtext for storage in a database. I know I could use the URL pass method, but we're talking about a lot of content here.

I will have a form with some <textarea> elements that will hold alot of data. This data needs to be put into the MySQL database.

Does anyone have any suggestions on a method to use to pass this information?

Thanks in advance
 
POST is the usual method.



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Doesn't post go via the URL?

I'm just wondering if it is good/bad to transfer large amounts of data through the URL, or is there a way to put the text in a file and have that file read and the data stored in the database.

Here's a small example:

1. User fills out form that contains some elements that can contain multiple paragraphs of text if the user so requires.

2. User hits send.

Now here's where I'm looking for some direction.

Do I...

A. Send through the URL and have the receiving page pull the variable with $_GET or something similar.

or...

2. Do I have it save the data to a file somewhere (probably via javascript or something client-side), and then have the receiving page call on that file to retrieve the data.

or...

0011. Is there some other efficient method that I'm not recognizing.


Any information anyone has on which method to use and why it would be greatly appreciated.
 
Using POST, the data is NOT sent in the URL (that's GET).

POST data is sent as some other technical term that really means it's sent as a data stream external to the URL.

This is normal stuff, unless I'm missing something here.

D.E.R. Management - IT Project Management Consulting
 
I'm sorry, I guess I'm not being clear enough.

Basically put, is it more efficient to upload via post/get or is it more efficient to save to a file then call that file back up after the new page is loaded?
 
First POST and GET are two different methods. With GET you have a limit of how much data you can send POST doesn't have that limit.

Saving to File is irrelevant as PHP has no way of accessing files on the client, and if your saving the file on the server then the transfer is also irrelevant as there is none. PHP saves to the file and then reads from it without actually passing information to or from the browser.

If you save a file on the client and then upload it to the server then again you are using the POST method.

So to answer your question... POST allows for a larger data transfer. GET has a limit. although the exact number escapes me at the moment.






----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
the character limit using the GET transfer method depends on the browser.

i ran an experiment about 3 months ago comparing browsers and posted the results in this forum.
 
OK, Thank you folks. I appreciate your assistance. Obviously managing this quantity of data is new to me, so I was just looking for the correct method, and it looks like post is simply the best.

One other question though. Why even have the GET method if post seems to do just that and more (without all that junk in the url)?
 
POST is normally associated with forms being sumitted.

GET *can* be used for forms, but is more associated with other tricks for redirection, cookie-less session support, source URL tracking from ad networks, and a host of other things...



etc.....

More often than not I find that I code to the GET strings to pass stuff along or to understand how I got there from another point of origin. POST, again, is primarily used for submitting forms data.

HTH.

D.E.R. Management - IT Project Management Consulting
 
if there were no "GET" method you would not be able to type a url into a browser address bar and retrieve a page or other content.

GET literally gets content from a server
POST puts content on to a server

but with the advent of server side scripting, the webservers can parse the information put into an address bar (or otherwise forming the get request) and can use the resulting information to take certain actions.

in the normal course of events I would tend always to use POST for forms. This is particularly so for dynamic data. However where the form is a guided search and thus creates a "dynamic view" or links to a static data I often use GET so that the "search" can be bookmarked without the need to repopulate the form. Of course I could just code for saved searches but users seem to like saving things to bookmarks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top