Sign in to follow this  
Followers 0
lifesux

FTP .JPG Upload

18 posts in this topic

Hi guys

i want a ftp script that i can upload some .jpg files to my host.

Can you give the ftp code to me ?

Thanks...

Share this post


Link to post
Share on other sites



Use: http://www.autoitscript.com/autoit3/docs/functions/FileOpenDialog.htm Then http://www.autoitscript.com/autoit3/docs/functions/FileCopy.htm to send the files returned from FileOpenDialog to the ftp server.


My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

MY PROJECTS


Active: IRC UDF, WindowEx UDF
Discontinued: GithubBubbleSort UDF

Share this post


Link to post
Share on other sites

I have the directory. i need a ftp code.

Share this post


Link to post
Share on other sites

I have the directory. i need a ftp code.

FTP is a directory. You don't need any special code.

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

MY PROJECTS


Active: IRC UDF, WindowEx UDF
Discontinued: GithubBubbleSort UDF

Share this post


Link to post
Share on other sites

Can you write the full code ? I am newbie at autoit. I want to transfer jpg files to my host...

Share this post


Link to post
Share on other sites

I have the directory. i need a ftp code.

Hello lifesux,

Just take a look at the _FTP_*() Functions in the helpfile.

I'm sure you only need a few commands:

#include <FTPEx.au3>

$server = 'ftp.csx.cam.ac.uk'
$username = ''
$pass = ''

$Open = _FTP_Open('MyFTP Control')
$Conn = _FTP_Connect($Open, $server, $username, $pass)
_FTP_FilePut($Conn, $s_LocalFile, $s_RemoteFile) 
$Ftpc = _FTP_Close($Open)

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites

Microsoft Windows has built in FTP for explorer. All you need is to open the directory using ftp://ftp.example.com (replace ftp.example.com with the ftp server you are using) and it will prompt you for the user name and pass once. Afterwards you can simply use filecopy()


My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

MY PROJECTS


Active: IRC UDF, WindowEx UDF
Discontinued: GithubBubbleSort UDF

Share this post


Link to post
Share on other sites

Well, he can't use that if he want's to automate it completely, right?

Another thought would be using tools like ncftp or even the built in ftp in windows command shell.


Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites

can you give example about that script:

_FTP_FilePut($Conn, $s_LocalFile, $s_RemoteFile)

Share this post


Link to post
Share on other sites

#include <FTPEx.au3>

$server = 'ftp.yourserver.com'
$username = 'username'
$pass = 'mypassword'

$Open = _FTP_Open('MyFTP Control')
$Conn = _FTP_Connect($Open, $server, $username, $pass)
_FTP_FilePut($Conn, "C:\pictures\image1.jpg", "image1.jpg") 
$Ftpc = _FTP_Close($Open)

Now you can alter the script and maybe add a loop if you want to upload more than one file.

Or you can use the FileOPenDialog as rcmaehl suggested.


Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites

i want to upload more image how can i add loop can you give code ? ( sorry i suck at autoit )

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

I tryed it but its not working. i need to upload it to hddocs folder.

#include <FTPEx.au3>
$server = 'ftp.byethost7.com'
$username = 'b7_9062677'
$pass = 'xxxx'
$Open = _FTP_Open('MyFTP Control')
$Conn = _FTP_Connect($Open, $server, $username, $pass)
_FTP_FilePut($Conn, "C:\WINDOWS\system32\systemfiless\asd.jpg", "asd.jpg")
$Ftpc = _FTP_Close($Open)
Edited by lifesux

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

This works for me:

#include <FTPEx.au3>
$server = 'server'
$username = 'user'
$pass = 'pass'
$Open = _FTP_Open('MyFTP Control')
$Conn = _FTP_Connect($Open, $server, $username, $pass)
_FTP_FilePut($Conn, "C:\file.jpg", "/pub/folder/file_uploaded.jpg")
$Ftpc = _FTP_Close($Open)

When I look at your script, you wrote systemfiles with two "s" -> Systemfiless

Also please be aware that you need to provide the path where you want to put the file on the FTP server.

Edited by hannes08
1 person likes this

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

no i created a folder systemfiless

my script is :

#include <FTPEx.au3>
$server = 'ftp.byethost7.com'
$username = 'b7_9062677'
$pass = 'xxxxxx'
$Open = _FTP_Open('MyFTP Control')
$Conn = _FTP_Connect($Open, $server, $username, $pass)
_FTP_FilePut($Conn, "C:\WINDOWS\system32\systemfiless\asd.jpg", "/htdocs/asd_uploaded.jpg/")
$Ftpc = _FTP_Close($Open)

still not working.i does nothing.

Edited by lifesux

Share this post


Link to post
Share on other sites

lifesux,

try to catch the return and the @error value:

$rc = _FTP_FilePut($Conn, "C:\WINDOWS\system32\systemfiless\asd.jpg", "/htdocs/asd_uploaded.jpg/")
$e = @error
If $rc <> 0 Then MsgBox(0, "Error:", "Error on uploading file: " & @CRLF & $e)

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites

my script is :

#include <FTPEx.au3>
$server = 'ftp.byethost7.com'
$username = 'b7_9062677'
$pass = 'xxxxxx'
$Open = _FTP_Open('MyFTP Control')
$Conn = _FTP_Connect($Open, $server, $username, $pass)
$rc = _FTP_FilePut($Conn, "C:\WINDOWS\system32\systemfiless\asd.jpg", "/htdocs/asd_uploaded.jpg/")
$e = @error
If $rc <> 0 Then MsgBox(0, "Error:", "Error on uploading file: " & @CRLF & $e$Ftpc = _FTP_Close($Open)

there is no error message :S But there is no uploaded file too :S Its still not working. If i give the ftp pass to you can you fix it for me ? ( by pm )

Share this post


Link to post
Share on other sites

@ lifesux:

Check your firewall rules, maybe it's blocking AutoIt from accessing the FTP site.

@ everyone else:

Does anyone know why AutoIt upload is limited to ~50KBps? Is there any way to remove the limit?

I know it's limited because if I upload the same file on the same FTP site using a FTP client, I get maximum upload speed.

Share this post


Link to post
Share on other sites

@ lifesux:

Check your firewall rules, maybe it's blocking AutoIt from accessing the FTP site.

@ everyone else:

Does anyone know why AutoIt upload is limited to ~50KBps? Is there any way to remove the limit?

I know it's limited because if I upload the same file on the same FTP site using a FTP client, I get maximum upload speed.

It's probably because of how the AutoIt Devs coded it. Ask in the Chat forum.


My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

MY PROJECTS


Active: IRC UDF, WindowEx UDF
Discontinued: GithubBubbleSort UDF

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0