Author Topic: ftp upload routine  (Read 7245 times)

0 Members and 1 Guest are viewing this topic.

TopoWAR

  • Newt
  • Posts: 135
ftp upload routine
« on: December 05, 2012, 11:59:58 AM »
hello teachers, there is a routine that allows uploading files to an ftp server? I know of to lose, but I have not found anything up. Thanks for your attention.
Thanks for help

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: ftp upload routine
« Reply #1 on: December 05, 2012, 12:50:17 PM »
vla-putremotefile immediately springs to mind, though I'm sure there are more advanced methods by interfacing with ActiveX objects outside of the AutoCAD Object Model.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: ftp upload routine
« Reply #2 on: December 06, 2012, 04:20:11 AM »
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

TopoWAR

  • Newt
  • Posts: 135
Re: ftp upload routine
« Reply #3 on: December 06, 2012, 01:52:03 PM »
thanks lee-mac, but know how to apply vla-putremotefile, I know nothing of v-la ...
but I'll try
Thanks for help

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: ftp upload routine
« Reply #4 on: December 06, 2012, 06:01:41 PM »
thanks lee-mac, but know how to apply vla-putremotefile, I know nothing of vla- ...

putremotefile is a method of the VLA Utility object, hence you would call it as follows:

Code - Auto/Visual Lisp: [Select]

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: ftp upload routine
« Reply #5 on: December 06, 2012, 11:51:11 PM »
...you would call it as follows:...
Problem with the highlighted code - the vla-putremotefile links to the index page, but there's no such function listed (as I'd expect since its an ActiveX method - not a normal lisp function).
 
To use these you'd need to check the ActiveX help: http://entercad.ru/acadauto.en/index.html?page=idh_utility_object.htm
Also available as a chm file in your acad install: C:\Program Files\Common Files\Autodesk Shared\acadauto.chm
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

TopoWAR

  • Newt
  • Posts: 135
Re: ftp upload routine
« Reply #6 on: December 07, 2012, 08:39:18 AM »
I did as follows but only returns nil, that may be wrong?
(vla-putremotefile
       (vla-get-utility (vla-get-activedocument (vlax-get-acad-object)))
       "http://www.topowar.net/Otros"
       "c:\\leame.txt"
    )

is supposed to ask for the username and password of ftp?
Thanks for help

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: ftp upload routine
« Reply #7 on: December 07, 2012, 09:15:51 AM »
ftp://[User Name]:[Password]@[address]

as exempl:

ftp://UserName:MyPassword@ftp.thest.com

TopoWAR

  • Newt
  • Posts: 135
Re: ftp upload routine
« Reply #8 on: December 07, 2012, 09:21:37 AM »
ElpanovEvgeniy , fantastic, I'll prove it, thank you very much!
Thanks for help

bilançikur

  • Newt
  • Posts: 82
Re: ftp upload routine
« Reply #9 on: December 07, 2012, 10:35:14 AM »
Curious about where this might lead to, I tried the next code:

Code: [Select]
(vla-putremotefile
  (vla-get-utility (vla-get-activedocument (vlax-get-acad-object)))
  "ftp://user:password@ftp.domain.com//public//sites//www.domain.com//files//"
  "c:\\test.dwg"
)

It returns:
Code: [Select]
  ;error: Automation Error. Inet: session connect failed

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: ftp upload routine
« Reply #10 on: December 08, 2012, 01:20:09 AM »
Could be any one of a number of reasons:
  • Username and/or password incorrect
  • URL incorrect
  • Path not existent
  • Insufficient rights to path (i.e. no write access)
  • Server down / hanging
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: ftp upload routine
« Reply #11 on: December 08, 2012, 01:55:38 AM »
real test:

ftp://anonymous:test@ftp.autodesk.com

old autodesk FTP...

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: ftp upload routine
« Reply #12 on: December 08, 2012, 02:29:11 AM »
I think the issue is: this is testing a PUTremotefile. On that site the anonymous user does not have write access, so the function will fail.

The only way to test it would be to use a url to a server with a username which has write access.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

Peter2

  • Swamp Rat
  • Posts: 650
Re: ftp upload routine
« Reply #13 on: May 15, 2017, 02:35:03 AM »
Code: [Select]
...  "ftp://user:password@ftp.domain.com//public//sites//www.domain.com//files//"...

I just failed with that code on two different ftp-addresses, and this is why I asked about the syntax of the address above

- "ftp" at the beginning (that's clear)
- "ftp" after @ - I'm not sure ..
- "www" in the middle of the address - ????

Is there some really special to consider?
« Last Edit: May 15, 2017, 04:49:06 PM by Peter2 »
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

TopoWAR

  • Newt
  • Posts: 135
Re: ftp upload routine
« Reply #14 on: May 15, 2017, 10:55:29 AM »
I have tried in a thousand ways and I have not managed to make it work, maybe some teacher can collaborate with some test, thanks :-(
Thanks for help

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: ftp upload routine
« Reply #15 on: May 17, 2017, 09:39:50 AM »
Code: [Select]
...  "ftp://user:password@ftp.domain.com//public//sites//www.domain.com//files//"...Is there some really special to consider?
Not really an issue no.
  • The first ftp:// simply states the protocol used.
  • The second is because the site's name contains it. Many sites use the same domain name and then a www prefix for their web pages and a ftp prefix for the ftp server.
  • The www portion (I'm assuming) is just a folder name in the ftp server's shared folders.
I have tried in a thousand ways and I have not managed to make it work, maybe some teacher can collaborate with some test, thanks :(
Something weird though ... that code uses double forward slashes. It may just the why this isn't working. You don't need to escape forward slashes, only backslashes. I.e. a "\\" is interpreted as a single \, but a / can simply be used as "/".

Other than that (and the rest of the things previously mentioned) I cannot think of why this shouldn't work. It should rather look like this:
"ftp://user:password@ftp.domain.com/public/sites/www.domain.com/files/"

Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

wkmvrij

  • Guest
Re: ftp upload routine
« Reply #16 on: May 19, 2017, 06:08:09 PM »
You tried:

(vla-putremotefile
       (vla-get-utility (vla-get-activedocument (vlax-get-acad-object)))
       "http://www.topowar.net/Otros"
       "c:\\leame.txt"
    )

From the Autodesk Helpfile on the complimentary function VLA-GETREMOTEFILE:
 

(setq doc (vla-get-ActiveDocument acadObj))

    (setq Utility (vla-get-Utility doc))   ;; Connect to Utility object
   
    ;; Prompt user for a URL to download. This should be a URL to an AutoCAD drawing file.



I never tried these functions myself, but it seems likely that they are selective of the type of files to be transferred
 

Andrea

  • Water Moccasin
  • Posts: 2372
Re: ftp upload routine
« Reply #17 on: May 30, 2017, 02:09:19 PM »
just curious....

why not trying to map a drive letter to this FTP....and then,...use vl-file-copy into it ?
Keep smile...

Peter2

  • Swamp Rat
  • Posts: 650
Re: ftp upload routine
« Reply #18 on: May 30, 2017, 03:56:50 PM »
Maybe it would work on internal usage, but I see problems if the function runs in a common routine on different, "foreign" PCs.
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

Andrea

  • Water Moccasin
  • Posts: 2372
Re: ftp upload routine
« Reply #19 on: May 30, 2017, 05:19:00 PM »
create a VBScript file..
https://www.example-code.com/vbscript/ftp_passiveUpload.asp

then,...call it from lisp... ?
Keep smile...

PKENEWELL

  • Bull Frog
  • Posts: 317
Re: ftp upload routine
« Reply #20 on: June 02, 2017, 04:57:17 PM »
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt