Help with this Wap Uploadr [PHP] script..
Posted: Tue Dec 05, 2006 6:46 pm
I've tried and tried but no luck.. This script is a wap uploader, you upload (for example) a wallpaper, and then you can download it via your mobile wap...
The think is, in the first form (where you choose the file to upload), i need to have a choice to let the users resize the image to what they want, and then upload it...
Can anyone help me on this?? I know it's not difficult, but i can't do it...
This script is freeware, i download it from hotscripts.com
This are the files that I think controls the uploading...
index.php
***********************************************************************
uploadfile.php
here's a working example of this script... but it doesnt have the resize option that i want to add...
http://www.ansari4u.com/mobile/wap/wap.php
The think is, in the first form (where you choose the file to upload), i need to have a choice to let the users resize the image to what they want, and then upload it...
Can anyone help me on this?? I know it's not difficult, but i can't do it...
This script is freeware, i download it from hotscripts.com
This are the files that I think controls the uploading...
index.php
Code: Select all
<?php
include 'config.php';
$nu = time();
$sql = ("SELECT * FROM wapupld_upload");
$result = mysql_query($sql, $db);
$enable = 0;
while($rs = mysql_fetch_array($result) ){
$uptime = $rs["dato"];
$idnm = $rs["idnm"];
$filname = $rs["filname"];
if(($nu-$uptime) >= $timeallowed) { // slet filen den er udløbet
unlink("tmpfiles/$filname");
$sql = ("DELETE FROM wapupld_upload WHERE idnm='$idnm'");
mysql_query($sql, $db);
}
}
?>
<form enctype='multipart/form-data' action='<?php echo("$urltoindex");?>/uploadfile.php' method='post'>
<table cellspacing='2' cellpadding='2' border='0'>
<tr>
<td><p>file: </font></td>
<td><input name='fil' type='file'></td>
</tr>
<tr>
<td><p>file size limit: </font></td>
<td><?php $r = $allowedsize/1024; echo("$r kb");?></td>
</tr>
<tr>
<td><input name='submit' type='submit' value='Send File'> </td>
<td></td>
</tr>
<input type='hidden' name='from' value='tree'>
</table>
</form>
<?php checklic($license);?>uploadfile.php
Code: Select all
<?php
include 'config.php';
//Her skal filen flyttes fra
$src = $_FILES['fil']['tmp_name'];
//Hvilken type fil arbejder vi med?
$ext = strtolower(end(explode(".", $_FILES['fil']['name'])));
$filnavn = $_FILES['fil']['name'];
$tid = substr(time(), 4);
$nytNavn = $tid.".".$ext;
if(substr($tid,5)== 0)
autom($wapurl,$urltoindex);
$dst = "tmpfiles/" . $nytNavn;
copy($src, $dst);
$fsize = filesize($dst);
if(($fsize >= $allowedsize) OR $ext=="php" OR $ext=="htm" OR $ext=="html") {
unlink("tmpfiles/$nytNavn");
echo("file not uploaded");
}
else { //upload
$min = $timeallowed/60;
$hours = $min/60;
echo("File uploaded, go to $wapurl and enter this id: $tid<br>");
//gem i db
$sql = ("INSERT INTO wapupld_upload(idnm,filname,dato) VALUES('$tid','$nytNavn','".time()."')");
mysql_query($sql, $db);
}
echo("<br><a href='$urltoindex/index.php'>Click here to upload a new file</a>");
?>http://www.ansari4u.com/mobile/wap/wap.php