Notifications
Clear all

[Closed] Uploading a file via MaxScript

Is it possible to upload a file via MaxScript (or by perhaps running a batch file “behind the scenes”, as it were) ? I’m researching it myself right now, and will come back with what I find for future reference, but in the meantime I’ll appreciate any contributions!

Cheers,

Mikkel

7 Replies
 PEN

I have never tried it but I’m guessing dotnet is the answer here. At one point I played with Max connecting to the internet for script updates but that wasn’t pushing anything up, just pulling down.

I will see if I can find those tests but if I remember right there was a thread on it some where here.

I was thinking of this too…had a look at the email code in the help file but haven’t got to it yet. Wonder if anyone else has used that?

 PEN

I use the email code in my license system but that will not get you any where near FTPing.

You can use a .NET WebClient.
http://msdn.microsoft.com/en-us/library/36s52zhs.aspx

I use this in the crash report tool in the Outliner:
Line 463 ~ 494
https://github.com/Pjanssen/Outliner/blob/master/maxscript/script/crash_report.ms

Sounds interesting! I’ll look into what Pjanssen posted. Like Paul I’ve been doing a few things with pulling data down, and setting values in a database, but from there and to uploading files is a leap – especially since what I ultimately need this for will be files in the 3-5 MB range – nothing insane, but way beyond where I’d contemplate sending them as anything but binary files.

In the end, I went another route, that seemed simpler – deceptively so, in fact!

I created a .bat file, with the following content:


@echo off
echo user FTP-USER-NAME> ftpcmd.dat
echo FTP-PASSWORD>> ftpcmd.dat
echo cd %2>> ftpcmd.dat
echo bin>> ftpcmd.dat
echo put %1>> ftpcmd.dat
ftp -n -s:ftpcmd.dat FTP-SERVER-NAME
bye
del ftpcmd.dat
exit

and used


shelllaunch "C:\scripts\fileup.bat" "C:\Users\Mikkel\Desktop\Up\dos_me2.psd psdfolder/"

where the first parameter to fileup.bat is the path to the file being uploaded, and the second parameter is the name of the folder to put it in. It can be expanded upon a lot for more advanced use I’m sure, but it was enough for me for my present task.

Credit where it’s due, the majority of this came from a post on howtogeek .

Artur Leao has made a small tool to upload files with ftp. It’s here on cgTalk: http://forums.cgsociety.org/showpost.php?p=5837287&postcount=17

I’ve just updated a tool myself to publish models to sketchfab. Sketchfab is an online platform which displays 3d-models using webgl. Go check it out, it’s very cool!

Anyway, my tool uses a HttpWebRequest to post the data in the shape of a json-file to that platform. Access is managed by api-keys. Find the script on my blog. You can look up the method which contains that httpWebRequest. There are plenty of comments: http://www.klaasnienhuis.nl/WordPress/2012/07/show-your-3d-models-on-sketchfab/