Fwd: Uploading Files with LiveCode Server

Pierre Sahores sc at sahores-conseil.com
Sun Dec 29 15:29:05 EST 2013


Hi Gregory,

Sorry. As i never went in this way to design files upload procedures, i will not be the more able to help to get this up and running. Perhaps should you follow the LiveCode example you spoken about yesterday. Comparing the way it works under PHP could help too ;_/

Note : you would normally not have to handle the file move by shell : it works out of the box on livecode server using :

put url ("binfile://pathtocurrentfiledestination.pdf") into url ("binfile://pathtonewfiledestination.pdf") 

Pierre


Début du message réexpédié :

> De : Gregory Lypny <gregory.lypny at videotron.ca>
> Objet : Rép : Uploading Files with LiveCode Server
> Date : 29 décembre 2013 20:26:51 HNEC
> À : LiveCode <use-livecode at lists.runrev.com>
> Répondre à : How to use LiveCode <use-livecode at lists.runrev.com>
> 
> Hi Pierre,
> 
> Thank you kindly sharing your code. I’m afraid that it is a little too advance for my skills, and my needs are much simpler. I am able to create an upload form and move the uploaded file from the tmp folder on my Mac to another folder using a shell command. There are only two problems left that I need to fix. One is that an internal server error occurs (error 500) and it is output to the web page. The other problem is that the moved file has read and write access for group _WWW but no access for anyone else.
> 
> Here is what I did. The HTML in the web page is 
> 
> <html>
> <head></head>
> <body>
> <H1>Upload Form</H1>
> <form enctype="multipart/form-data" action="submitAssignmentScript.lc" method="POST">
> Choose a file to upload: <input name="uploadedfile" type="file" /><br />
> <input type="submit" value="Upload File" />
> </form>
> </body>
> </html>
> 
> where the action, “submitAssignmentScript.lc”, simply refers to a handler named submitAssignment in a stack named myServer
> 
> <?lc
> start using stack myServer.livecode
> submitAssignment
> ?>
> 
> The handler contains the following
> 
> on submitAssignment
>   put the keys of $_Files[uploadedfile] into theKeys
>   put the long date && long time & return into output
>   repeat for each line thisLine in theKeys
>      put thisLine & ":" && $_Files[uploadedfile][thisLine] & return after output
>   end repeat
>   delete the last character of output
>   put output into url (dataFilePath & "Upload Info.csv") 
>   get shell ("mv" && $_Files[uploadedfile][filename] && "../share/httpd/myData/" & “Uploaded-File.pdf") 
> end submitAssignment
> 
> where “Upload Info.csv” contains some information from $_Files.
> 
> If anyone can help me figure out why I’m getting the the internal server error and how I can change the moved file’s permissions, I’d much appreciate it.
> 
> Regards,
> 
> Gregory
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

--
Pierre Sahores
mobile : 06 03 95 77 70
www.sahores-conseil.com





More information about the use-livecode mailing list