on-rev file upload and upload path?
neil at runrev.com
neil at runrev.com
Fri Apr 26 18:17:10 EDT 2013
Dear John,
Thank you for your request
One method of uploading afile to as specific directory on the on-rev
server is by using a shell command-
<?lc
set the errorMode to "inline"
?>
<html>
<head></head>
<body>
<H1>Upload Form</H1>
<form enctype="multipart/form-data" action="testupload.lc" method="POST">
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>
<H1>Uploaded Files</H1>
<p>
<?lc
create folder "uploadnew"
if $_Files[uploadedfile][error] then
put "There was an error uploading your file:" &&
$_Files[uploadedfile][error] & "<br />"
else
put $_Files[uploadedfile][filename] into tFilePath
get shell ("mv" && tFilePath && "~/public_html/testupload.txt")
?>
</p>
</body>
</html>
What the above shell command does is move ("mv") the file tFilePath to a
new location with a new filename. (I am uploading a text file but any file
can be uploaded along as the file extension is set correctly)
I hope this gives you some leads.
Kind Regards
Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
LiveCode Realize fast, compile-free coding
--
> Hi All
>
> I'm looking to upload a simple text file to a specific directory on the
> on-rev server. I've looked at the tutorial here
> http://lessons.runrev.com/s/lessons/m/4070/l/40708-how-to-upload-a-file-with-livecode-server
> and noticed in the comments that the file gets uploaded to tmp. However,
> when I look there I don't see the file
? But it reports a successful
> upload.
>
> Is there a way to script that file upload to save to a specific directory
> within the on-rev server, instead of tmp?
>
> Or, is it more recommended to have the lc engine write the file on the
> on-rev server just using post data, instead of uploading a file.
>
>
> Thank you!
>
> John Patten
> SUSD
>
> _______________________________________________
> 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
>
More information about the use-livecode
mailing list