FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Need Help, how to transfer to files to server using $_GET





Philip
Like the topic said,
how can i to transfer to files to server using $_GET,
since ussualy i uses transfer is $_File,

i am using Ajax so, i need to using $_GET
not $_POST and $_FILE also --"
hexkid
Philip wrote:
Like the topic said,
how can i to transfer to files to server using $_GET,
since ussualy i uses transfer is $_File,

i am using Ajax so, i need to using $_GET
not $_POST and $_FILE also --"


This is the request string for a base64 encoded file with 196 bytes (your post)
Quote:
http://example.com/get.php?name=test.txt&contents=TGlrZSB0aGUgdG9waWMgc2FpZCwNCmhvdyBjYW4gaSB0byB0cmFuc2ZlciB0byBmaWxlcyB0byBzZXJ2ZXIgdXNpbmcgJF9HRVQsDQpzaW5jZSB1c3N1YWx5IGkgdXNlcyB0cmFuc2ZlciBpcyAkX0ZpbGUsDQoNCmkgYW0gdXNpbmcgQWpheCBzbywgaSBuZWVkIHRvIHVzaW5nICRfR0VUDQpub3QgJF9QT1NUIGFuZCAkX0ZJTEUgYWxzbyAtLSINCg==

Are you sure you want to get files with $_GET? ???????

See the LimitRequestLine directive for Apache.
Philip
hexkid wrote:
Philip wrote:
Like the topic said,
how can i to transfer to files to server using $_GET,
since ussualy i uses transfer is $_File,

i am using Ajax so, i need to using $_GET
not $_POST and $_FILE also --"


This is the request string for a base64 encoded file with 196 bytes (your post)
Quote:
http://example.com/get.php?name=test.txt&contents=TGlrZSB0aGUgdG9waWMgc2FpZCwNCmhvdyBjYW4gaSB0byB0cmFuc2ZlciB0byBmaWxlcyB0byBzZXJ2ZXIgdXNpbmcgJF9HRVQsDQpzaW5jZSB1c3N1YWx5IGkgdXNlcyB0cmFuc2ZlciBpcyAkX0ZpbGUsDQoNCmkgYW0gdXNpbmcgQWpheCBzbywgaSBuZWVkIHRvIHVzaW5nICRfR0VUDQpub3QgJF9QT1NUIGFuZCAkX0ZJTEUgYWxzbyAtLSINCg==

Are you sure you want to get files with $_GET? ???????

See the LimitRequestLine directive for Apache.


yes, of course i am very2x need it since i am using ajax, there's no other way to up/download information expect using $_GET.

but i don't under stand what u mean ? can u tell me how to convert a file into base64 encode, and to uploadit ? however it see we cannot using php script, since it already on client side, may be javascript ???

thanks
hexkid
Philip wrote:
can u tell me how to convert a file into base64 encode, and to uploadit ?

JavaScript cannot read files from the hard disk. So there is no way to select a file to upload. What you can do with JavaScript is encode the contents of a textarea (the user has to open the file, copy and paste its contents in the textarea) and use that for the request.

I'm pretty sure you can find JavaScript encoders on the net.


Maybe this topic should be moved to the "Html, CSS and Javascript" forum ????
Philip
wew i am already try to find ! --"
And there said no way to upload files using ajax T_T

btw, that's not a gud way to ask user to open files and pasting,
espesially if the files is > 7 Mega wew
PatTheGreat42
Maybe AJAX isn't the best solution for what you're trying to do? AJAX is for up-to-the minute information, quick server-side calculations using a database, and stuff like that. Bits of information. I think 7 megabyte file uploads aren't instantly mission critical kinda stuff.
Philip
PatTheGreat42 wrote:
Maybe AJAX isn't the best solution for what you're trying to do? AJAX is for up-to-the minute information, quick server-side calculations using a database, and stuff like that. Bits of information. I think 7 megabyte file uploads aren't instantly mission critical kinda stuff.


not that some times i just thinked that if that ok if we upload using cool way, like using AJAX.
btw i learned that using ajax is inposible but there's a way like ajax but using iframe Smile
Agent ME
You CAN use POST method with AJAX... But it won't help you anyway as you can't read the file using javascript.
Philip
i know i know, and there is no way javascript can access clients files >_<
izcool
I'd recommend $_POST[] more instead of $_GET[] for if you're using forms. You can use either of them for forms, but I recommend $_POST[] more as it's more secure.

Example on how I use it with $_POST[] :

Page 1 :
Code:
<form action='page2.php' method='post'>
Enter a number :  <input type='Text' name='number'><br>
<button type='Submit'>Enter --></button></form>


Page 2 :
Code:
<?php
echo"You entered the number <b>$_POST[number]</b> in the previous page.";
?>


You can do the same thing for $_GET[] with that page too if you'd like, but $_POST is more secure from what I learned.

With $_GET[], you can also use it like this.

Let's say that the URL is like this : .../test.php?number=11
Code:
<?php
echo"The number that you entered in the address bar is <b>$_GET[number]</b>."; // In this case, it would show up as 11
?>


You cannot do that with $_POST[] though, as it's not through a form.

With $_GET[], you can commonly change the stuff that you enter from the address bar, with $_POST[], you cannot. That's why I use $_POST[] for forms instead of $_GET[]. I only use $_GET[] if I'm collecting information like that from the address bar.

BTW, I've heard of the $_REQUEST[] variable, but I never really explored into it on how it works.

- Mike.
JayBee
you want something, like add attachement in gmail Very Happy yes its cool, but I also dont know how they do it Very Happy

just view source than copy and paste Rolling Eyes
Philip
I know it;s more safety using $_POST, but when someone using AJAX for her/his sites, the variable will not show up in the address bar, so i think it safety also Smile

and i think there's many2x think that new on web programming, i need to upgrade my BRAIN for this thing.. hehe Smile

thanks,
Phil
Maryndor
Hehe.. that's awesome. File trough GET. Come on ... don't be lame! Wink
Related topics
How To : Secure Your PHP Website
Setting up Ftp Server
Auto-Patcher Xp (Aug) Released
uploading files through web browser
Best FTP Client on EARTH
bluetooth
Windows XP Tricks & Tips!!!!
Windows XP SP3 comming soon
Making a Web Server
Help:: Claroline is buggy...
Moveing files (using FileZilla)
Transfer files without downloading them!!
[Important]Server 2/3 move
Find the best tool to transfer files from iPad to PC
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.