HaserlCode

From Digisaster
Jump to: navigation, search

You can download haserl for stage2 here

This is just a sneak preview for the new Webconsole. Please test haserl and find out how simple it is to script with haserl.


Upload background

With this little script you can upload an image to the player. You have to set your background as: mypic!!!

bgup.cgi

 
#!/hdd/stage2/bin/haserl --upload-limit=4096 --upload-dir=/hdd/stage2/img --shell='/bin/hush'
content-type: text/html
<html><body>
<form action="<? echo -n $SCRIPT_NAME ?>" method=POST enctype="multipart/form-data" >
<input type=file name=uploadfile>
<input type=submit value=GO> 
<br>
<?if test -n "$FORM_uploadfile" ?>
        <p>
 You uploaded a background named <b><? echo -n $FORM_uploadfile_name ?></b>, and it is
 stored on the server as <i><? echo "/hdd/stage2/img/my.jpg" ?></i>  
    <? rm -f "/hdd/stage2/img/my.jpg"  ?> 
 <? mv -f "$FORM_uploadfile" "/hdd/stage2/img/my.jpg"  ?> 
 
<?el?>
 You haven't uploaded a background yet.
<?fi?> 

</form>
</body></html>