Page 1 of 1

Help with this Wap Uploadr [PHP] script..

Posted: Tue Dec 05, 2006 6:46 pm
by Maluendaster
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...
:evil:

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>");
	
?>
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

Posted: Tue Dec 05, 2006 6:55 pm
by Zoxive
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:2. Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.
And why not just like to the script at hotscripts, and or copy and paste it (if its not that big), and or copy and paste the parts of it your having problems with it. So we don't have to do more work by downloading the file, then we already do helping you.

Posted: Tue Dec 05, 2006 7:06 pm
by Maluendaster
Zoxive wrote:
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:2. Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.
And why not just like to the script at hotscripts, and or copy and paste it (if its not that big), and or copy and paste the parts of it your having problems with it. So we don't have to do more work by downloading the file, then we already do helping you.
first of all, sorry for the title...

I already posted the code...

Posted: Tue Dec 05, 2006 7:16 pm
by Ollie Saunders
I'm sorry you can't expect us to debug some code where the author isn't present. Also, remember the purpose of this forum is for learning PHP.
Sorry to give you such a bashing but I'm really not motivated to assist you and I don't see why others would be.

Posted: Tue Dec 05, 2006 7:21 pm
by Maluendaster
ole wrote:I'm sorry you can't expect us to debug some code where the author isn't present. Also, remember the purpose of this forum is for learning PHP.
Sorry to give you such a bashing but I'm really not motivated to assist you and I don't see why others would be.
i'm not asking to do the code, if you read carefully my post it says "Can anyone help me on this?", or something like that.... I'm not asking to do the entire code.

Posted: Tue Dec 05, 2006 8:17 pm
by John Cartwright
search these forums, I know onion2k has posted some snipplets on image resizing.