rCANE Posted January 15, 2010 Share Posted January 15, 2010 hi guys! i have a basic gui. i want 2 things. 1. upload a simple text file to a webserver. so there is a 10 kb text file ( mytext.txt ) and i want to send to the PHP to upload to the server ( www.mydomainaddress.com/upload.php ) i want progress/status infos about the uploading process ( the percentage, when completed tell me it's done, when erroroccurs tell me and if it's possible show the uploading speed ) 2. then i want to upload a jpg file... ( myimg.jpg ) send to the PHP ( www.mydomainaddress.com/upload.php ) and the same detailed status infos about the uploading process ( percentage,error handling,completed,speed ). the jpegs are between 350 kb and 1500 kb. is this posibble to do with autoit? if it is very big THX for an example code. thanks guys Link to comment Share on other sites More sharing options...
Datenshi Posted January 15, 2010 Share Posted January 15, 2010 (edited) It is possible, however if you're new to Autoit it could be challenging. Look at the TCP functions, they give the most control but they're more advanced. Then there's IE automation which I'm not sure would provide enough information for statistics. Look into it. Btw, there's no difference what type of file is sent. And you might want to provide the full link so people can check out that php upload script, in case you want examples. Edited January 15, 2010 by Datenshi RapidQueuer 2.4 - For Rapidshare.comOpensubtitles Hashing FuncRevision3 PlayerGTPlayer BetaIMDB & Poster Grabber v1.3Fetgrek.com - My Website Link to comment Share on other sites More sharing options...
rCANE Posted January 15, 2010 Author Share Posted January 15, 2010 (edited) thank you for your answer...the PHP for upload is based on this ( the only diff are file types and folders )i've found this topic, but how can i address my webserver's php when i send a file?what socket and ip should i use?...and that topic's example can give me somehow a detailed statistics? Edited January 15, 2010 by rCANE Link to comment Share on other sites More sharing options...
rCANE Posted January 16, 2010 Author Share Posted January 16, 2010 i copy/pasted some AutoIt code, but i can't find how to address the PHP file TCPStartup() $host = 'localhost' $IP = TCPNameToIp($host) $Socket = TCPConnect($IP,80) $Send = TCPSend($Socket,'the text to send') ; the path to the PHP file is: localhost/devscripts/upload/wm_upload.php PHP: <?php $path = "wm_upload_dir/"; if ($_FILES["file"]["size"] < 2000000) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists($path . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], $path . $_FILES["file"]["name"]); echo "Stored in: " . $path . $_FILES["file"]["name"]; } } } else { echo "Invalid file"; } ?> Link to comment Share on other sites More sharing options...
Pakku Posted January 17, 2010 Share Posted January 17, 2010 (edited) i copy/pasted some AutoIt code, but i can't find how to address the PHP file TCPStartup() $host = 'localhost' $IP = TCPNameToIp($host) $Socket = TCPConnect($IP,80) $Send = TCPSend($Socket,'the text to send') ; the path to the PHP file is: localhost/devscripts/upload/wm_upload.php Hi, I saw your PM, so here I go. I'll explain what you need to do and why, you can do the code stuff yourself. Since HTTP is based on TCP, you have to do your own HTTP requests and answer the HTTP responses received from the server. So, as you do, you setup a TCP connection on port 80 and then follow the following example http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Example_session This example isn't going to send a file to the server, but once you are able to get this working, it won't be difficult to get to upload a file. An interresting one: http://www.vbforums.com/showthread.php?t=337424 You need to deepen out this more yourself, but I hope the concept is clear. I could make an example, but you will learn more by deepen this out yourself. Let's make this interesting for both of us. If you deepen this out more, by providing more information or code, than I'll post a working one Edited November 16, 2010 by Pakku How can someone use Windows without using AutoIt?That one would properly don't know how to handle a computer!My scripts:Send files over internetKind of RSS reader3Draw ProUDF: convert a character string to a binary one and backCalculate PiCommand line downloader (Youtube/Google video)Set the transparency of a window just by hitting a key!Secure your pcOther things:My filemanMy profilePM me Link to comment Share on other sites More sharing options...
Pakku Posted January 17, 2010 Share Posted January 17, 2010 (edited) Hmm, what about a HTTP UDF? None found on the forum, would one like to develop one with me?Check below, it is exacly what you need. Edited November 16, 2010 by Pakku How can someone use Windows without using AutoIt?That one would properly don't know how to handle a computer!My scripts:Send files over internetKind of RSS reader3Draw ProUDF: convert a character string to a binary one and backCalculate PiCommand line downloader (Youtube/Google video)Set the transparency of a window just by hitting a key!Secure your pcOther things:My filemanMy profilePM me Link to comment Share on other sites More sharing options...
ProgAndy Posted January 17, 2010 Share Posted January 17, 2010 I made an example for WinHTTP: http://www.autoitscript.com/forum/index.php?showtopic=84133&view=findpost&p=610967 (Not sure if the example with imageshack is correct, but the function i use is still working) *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now