Uploading files with LiveCode is a relatively straight forward process. You need a form that will upload the file(s) to a script that will process the upload.

To illustrate how to upload a file, see the following example.

<form action="upload.lc" method="post" enctype="multipart/form-data" name="form1" id="form1">
<p>Choose</p>
<input type="file" name="fileField" id="fileField" />
<input type="submit" name="button" id="button" value="Submit" />
</form>
<?lc
if $_Files[uploadedfile][error] then
put "There was an error uploading your file:" && $_Files[uploadedfile][error] & "<br />" else
put $_Files[fileField][name] into tFileName
put $_Files[fileField][type] into tFileType
put $_Files[fileField][size] into tFileSize
put $_Files[fileField][filename] into tFilePath
put "Your file '" & tFileName & "' was uploaded successfully. It is" && tFileSize && "bytes in size and is located at" && tFilePath
end if 
put "<br />" & tFileType & "<br />"
put url("binfile:" & $_FILES["fileField"]["filename"]) into url("binfile:" & $_FILES["fileField"]["name"])
?>
Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.

Not readable? Change text. captcha txt

Start typing and press Enter to search