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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Major probs uploading file to internet

Status
Not open for further replies.

sborny

Technical User
Jun 29, 2001
157
0
0
GB
Hi all,

I have an app that uses the ITC. I can authenticate with the server and download a file with no problems whatsoever.

But, When I try to upload an empty file to over write what was just downloaded it will not work.

Here is the code for downloading the file

Code:
Sub fdload()
Form2.Inet1.Protocol = icFTP
    Form2.Inet1.URL = "ipaddress"
    Form2.Inet1.UserName = "username"
    Form2.Inet1.Password = "password"
    Form2.Inet1.Execute , "GET csv/app.csv o:\CSVAPP\app.csv"
    Do While Not inetReady
        DoEvents
    Loop
    Form2.Inet1.Execute , "CLOSE" ' Close the connection
    End Sub

Private Function inetReady() As Boolean
        inetReady = Not Form2.Inet1.StillExecuting
End Function

And here is the code for trying to upload:

Code:
Sub fuload()
Bimp.Inet2.Protocol = icFTP
    Bimp.Inet2.URL = "ipaddress"
    Bimp.Inet2.UserName = "username"
    Bimp.Inet2.Password = "password"
    
    Bimp.Inet2.Execute , "PUT" + App.Path + "\app.csv usr/home/d622wsnm/csv "
    
    Do While Not inetReady
        DoEvents
    Loop
    Bimp.Inet2.Execute , "CLOSE" ' Close the connection
End Sub

Private Function inetReady() As Boolean
        inetReady = Not Bimp.Inet2.StillExecuting
End Function

Basically when i try to upload it just sits there. I have tried to put a message box in that displys the icResponsecode, but it always comes back as 0.

I have been trying to get this to work for 2 days now and I am at my wits end.

Any help would be much appreciated.

Cheers

Symon

Everything has an answer, it's just knowing the right question to ask. !!!!
 
there will not be a space after the put command.

change this

Code:
Bimp.Inet2.Execute , "PUT" + App.Path + "\app.csv usr/home/d622wsnm/csv "

to this

Code:
Bimp.Inet2.Execute , "PUT " + App.Path + "\app.csv usr/home/d622wsnm/csv "

hope it helps

Matt

If you can keep your head while those around you are losing theirs, you obviously haven't grasped the seriousness of the situation
 
Hi MatDavies,

Thanks for that. I have put the space in and it know runs through the code and tells me that it has completed.

However when I log on the server using CuteFTP and look at the file. It has not been overwritten.

It's like Inet thinks it has done it but it actually has not.

I know if I want to overwrite something using CuteFTP, i have to confirm that i want to overwite before it will upload. I am wondering if there is something similar happening here and if so, is there an option in the PUT command to tell it to overwrite.

Any ideas.

Cheers

Symon.

Everything has an answer, it's just knowing the right question to ask. !!!!
 
sborny,
Have you tried to use the "send" command instead of the "put" command?
 
Hi bmdb,

Is the syntax the same for the send command.

If so then it makes no difference at all.

I just ran a test
opened the connection
deleted the file
closed the connection
re-opened the connection
used send command to send the file
closed the connection.

Now the file was deleted but not uploaded.

I am really begining to pull my hair out. This is the last thing I need to get working and then my app is finished.

Any more suggestions.

Cheers

Symon.


Everything has an answer, it's just knowing the right question to ask. !!!!
 
Don't you need the complete filename including the file extension? I noticed you left that off the "Put" statement. Have you tried to put some error checking in? Maybe on the inet2Inet1_StateChanged event you could look for .ResponseCode and .ResponseInfo. Hope I am helping at least a little.
 
My apologies,

I have got the full file name in the code I am currently using.

I have tried to put the error checking in just after the PUT line in the code and I always get back a response code of zero.

Cheers

Symon.

Everything has an answer, it's just knowing the right question to ask. !!!!
 
Hi,

I have just put in a line to produce a msgbox with the response code init eveytime the Inetstatechanged occured.

Every message box that appeared had a zero in it.

Any ideas.

Cheers

Symon.


Everything has an answer, it's just knowing the right question to ask. !!!!
 
Just for curiosity sake have you checked the entire server for the file? Maybe since it seems to be transferring the file maybe it is somehow putting it in the wrong directory. Maybe the root directory. It might be worth a quick check.
 
Hi all,

Okay I have now done the following test and still get no joy.

Note: the original directory I was trying to PUT the file to was outside the of the site.

I have created a new directory witth full access rights inside the of the site and it still does not upload the file.

I can't see why. This is really doing my head in.

Cheers

Symon.

Everything has an answer, it's just knowing the right question to ask. !!!!
 
Has your "PUT" statement changed from what is posted above or is it still exactly the same?
 
You might want to check your remote path.
 
One thought, does your app.path include spaces? The Inet control documentation says that it doesn't support embedded spaces.

so "PUT c:\myapp\app.csv usr/home/d622wsnm/csv/" is legal

"PUT c:\my app\app.csv usr/home/d622wsnm/csv" isn't.

hope you find the answer.

Matt

If you can keep your head while those around you are losing theirs, you obviously haven't grasped the seriousness of the situation
 
sborny,
I noticed that you have posted another question related to this app. The way the other issue is worded indicates that this particular issue has been resolved. Can you please confirm this and indicate what corrected your problem. Thanks.
 
Sorry again,

I have dropped the put statement and just deleted the file and then got the PHP script to recreate the file when the next form is submitted from the website.

Sorry for being a pain.

Cheers

Symon.

Everything has an answer, it's just knowing the right question to ask. !!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top