User Tag List

Page 1 of 6 1 2 3 ... LastLast
Results 1 to 10 of 55

Thread: How can I upload a file (using MooSock)?

  1. #1
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Jul 2006
    Location
    Pittsburgh, PA, USA
    Posts
    777
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How can I upload a file (using MooSock)?

    I'm almost positive that MooSock is what I would use to do this, but I have no idea how. I want the user to be able to upload a screenshot to a directory (more specifically, www.flufferfluff.com/games/battles/images/). I really hate MooSock, so I can already tell this is going to be hard to do. Can anyone help me?

  2. #2
    Clicker Multimedia Fusion 2

    Join Date
    Sep 2006
    Location
    Britain, South Coast
    Posts
    1,030
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How can I upload a file (using MooSock)?

    This would be very interesting to know, anyone.

    EDIT: Did a quick search, and Google returned this:

    How to upload a file using HTTP Protocol

    I'm not convinced that's how the websites do it, but there we go, it's what the article says.

    Basically so far as i can tell, you're sending it as a form post, but you're setting the value of a 'file' element to the byte data of the file itself. I'm thinking you'd wanna format that so it's URL safe, and of course you'd need a script on the serverside, to convert the variable into a file.

  3. #3
    Clicker Multimedia Fusion 2
    SEELE's Avatar
    Join Date
    Jul 2007
    Location
    Terra australis incognito
    Posts
    1,916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How can I upload a file (using MooSock)?

    don't use moosock, the protocol is to confusing.

    use ftp.

  4. #4
    Clicker Multimedia Fusion 2

    Join Date
    Sep 2006
    Location
    Britain, South Coast
    Posts
    1,030
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How can I upload a file (using MooSock)?

    But isn't FTP really unsecure?

  5. #5
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How can I upload a file (using MooSock)?

    You either need an upload script set up on the server ready to receive the file, or you need to use ftp (in which case you obviously need ftp access to the server).

    To send a file to an upload script it's something like:
    SENDLINE: "POST /folder/upload.php HTTP/1.1"
    SENDLINE: "Host: www.example.com"
    SENDLINE: "Content-type: multipart/form-data, boundary=AaB03x@:&%CCCds" (the "boundary" string shouldn't exist in the file you're uploading. It can be quite a pain to make one which definitely isn't in the file, so a random one like this one is often used instead.)
    SENDLINE: "" (blank line)
    SENDLINE: "--AaB03x@:&%CCCds" (this is "--" + the boundary string)
    SENDLINE: "content-disposition: form-data; name=""file""; filename=""filename.jpg""" (name is the name of the form field that the script expects, filename is the filename of what you're uploading)
    SENDLINE: "Content-Type: image/jpg" (the type of the file you're uploading. Use application/octet-stream if you don't know. See here for more)
    SENDLINE: "" (another blank)
    SENDFILE (filename.jpg) (send the file with MooSock's send file or send binary command (I don't remember what it's called offhand))
    SENDLINE: "--AaB03x@:&%CCCds--" (this is "--" + the boundary string + "--")

  6. #6
    Clicker Multimedia Fusion 2
    SEELE's Avatar
    Join Date
    Jul 2007
    Location
    Terra australis incognito
    Posts
    1,916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How can I upload a file (using MooSock)?

    Are they gonna steal his images?

    and no it just allows for unsecured 'anonymous' transfers but you can add heeps of security.

  7. #7
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Jul 2006
    Location
    Pittsburgh, PA, USA
    Posts
    777
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How can I upload a file (using MooSock)?

    I should add that this is strictly a vitalized application. That may help...or not.

    Quote Originally Posted by SEELE
    don't use moosock, the protocol is to confusing.

    use ftp.
    FTP has not been vitalized. Sorry for not mentioning that earlier.

    Quote Originally Posted by Dynasoft
    SENDLINE: "POST /folder/upload.php HTTP/1.1"
    SENDLINE: "Host: www.example.com"
    SENDLINE: "Content-type: multipart/form-data, boundary=AaB03x@:&%CCCds" (the "boundary" string shouldn't exist in the file you're uploading. It can be quite a pain to make one which definitely isn't in the file, so a random one like this one is often used instead.)
    SENDLINE: "" (blank line)
    SENDLINE: "--AaB03x@:&%CCCds" (this is "--" + the boundary string)
    SENDLINE: "content-disposition: form-data; name=""file""; filename=""filename.jpg""" (name is the name of the form field that the script expects, filename is the filename of what you're uploading)
    SENDLINE: "Content-Type: image/jpg" (the type of the file you're uploading. Use application/octet-stream if you don't know. See here for more)
    SENDLINE: "" (another blank)
    SENDFILE (filename.jpg) (send the file with MooSock's send file or send binary command (I don't remember what it's called offhand))
    SENDLINE: "--AaB03x@:&%CCCds--" (this is "--" + the boundary string + "--")
    Is that the script for MooSock or FTP?


    EDIT: Here's an idea. When someone wants to send the image, they could send it to an application I always have running on my computer (not vitalized) and then that application would upload it. Would that work?

  8. #8
    Clicker Multimedia Fusion 2

    Join Date
    Sep 2006
    Location
    Britain, South Coast
    Posts
    1,030
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How can I upload a file (using MooSock)?

    Dynasoft's post is what you're after. It's for MOOSock, just do that, but you'll need a PHP or ASP script to handle the file afterwards.

    With PHP (dunno about ASP or CGI), files sent via POST get stored in a temp folder, and will be deleted if they aren't handled properly. The script you link to (folder/uploads.php in Dynasoft's example) should spot the file, validate it, and then move it to the required location.

    Although, are you sure you'll be able to load external images from the hard drive in a Vitalize app? It's very security conscious, you may have trouble doing that.

  9. #9
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Jul 2006
    Location
    Pittsburgh, PA, USA
    Posts
    777
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How can I upload a file (using MooSock)?

    Wow, Dynasoft. I originally had you in the credits as "special thanks," but at this rate I'm going to have to promote you to programmer. Thanks for all of your help. I'll try it out and see what happens.

    EDIT: Unfortunitely, it didn't work. Here's the events I made in the events editor:


    ....and here's what's in the upload.php file:
    PHP Code:
    <?php

    $target 
    "images/";
    $target $target basename$_FILES['uploaded']['image']) ;

    ?>
    Any idea what I did wrong? :confused:

    EDIT 2: I asked MooSock to return what it received, and here it is:
    Code:
    HTTP/1.1 200 OK
    Date: Thu, 15 May 2008 04:11:45 GMT
    Server: Apache/2.2.8 (Unix) mod_ssl/2.2.8 OpenSSL/0.9.8g DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
    X-Powered-By: PHP/5.2.6
    Content-Length: 0
    Content-Type: text/html
    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <html><head>
    <title>501 Method Not Implemented</title>
    </head><body>
    <h1>Method Not Implemented</h1>
    <p>--AaB03x@:&amp;%CCCds to /default.shtml not supported.<br />
    </p>
    <hr>
    <address>Apache/2.2.8 (Unix) mod_ssl/2.2.8 OpenSSL/0.9.8g DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at host116.hostmonster.com Port 80</address>
    </body></html>
    This should help.

  10. #10
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How can I upload a file (using MooSock)?

    Ok, looking at the docs for php's $_FILES, I see that:
    $_FILES['uploaded']['image']
    is wrong, it should be one of:
    $_FILES['image']['name'] for the original filename
    $_FILES['image']['tmp_name'] for the temporary uploaded filename

    Also, seems I missed something, you need to add a "Content-length: xxx" line after the first "content-type: yyy" line, with the size in bytes of all the data you're sending after the first blank line.
    The size should be:
    (3x"--")+(2xlength of boundary string)+(length of the content-disposition line)+(4xlength of Moosock's end-line symbols, probably 2, could be 1)+(size of the file)
    SENDLINE: "Content-length: "+str$(3*len("--")+2*len("AaB03x@:&%CCCds")+len("content-disposition: form-data; name=""file""; filename="""+EditText$("Edit")+"""")+4*2+filesize)

    EDIT: Yup, I just sent the following using telnet:
    Code:
    POST /games/battles/upload.php HTTP/1.1
    Host: www.flufferfluff.com
    Content-type: multipart/form-data, boundary=AaB03x@:&%CCCds
    Content-length: 133
    
    --AaB03x@:&%CCCds
    content-disposition: form-data; name="image"; filename="testing.txt"
    
    ABC_TESTING_TESTING
    --AaB03x@:&%CCCds--
    and your server came back with:
    Code:
    HTTP/1.1 200 OK
    Date: Thu, 15 May 2008 09:13:48 GMT
    Server: Apache/2.2.8 (Unix) mod_ssl/2.2.8 OpenSSL/0.9.8g DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
    X-Powered-By: PHP/5.2.6
    Content-Length: 0
    Content-Type: text/html
    "200 OK" means success, it worked.

Page 1 of 6 1 2 3 ... LastLast

Similar Threads

  1. FTP file upload
    By MarkClick in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 13th April 2009, 11:32 AM
  2. MooSock Upload?
    By Iharmi in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 16th August 2008, 10:08 PM
  3. Any method to upload a file fast to an ftp ?
    By Rushino in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 4th October 2007, 09:31 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •