code for url link in place of upload

Discussion in 'PHP' started by phpx, Jan 18, 2010.

  1. #1
    hi,

    i always get staked in this please, please tell that

    i want use url in place of upload,
    Example: i want to view a song in my site, but for viewing that song there is only one option that is upload, I want to put a url link in place of upload. tell me how can i totally remove upload features, in place of upload how i what i code that shows and ask for just url of that song.

    I need it please intelligent peoples help me:confused:
     
    phpx, Jan 18, 2010 IP
  2. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Show some code, we're not mind readers
     
    JAY6390, Jan 18, 2010 IP
  3. phpx

    phpx Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    its the upload php code everyone uses in uploader.php
    <?
    	if ($_FILES['Filedata']['name'] && ($log = fopen('./upload.log', 'a') ) )
    	{
    		$file = $_FILES['Filedata']['tmp_name'];
    		$error = false;
    
    		/**
    		 * THESE ERROR CHECKS ARE JUST EXAMPLES HOW TO USE THE REPONSE HEADERS
    		 * TO SEND THE STATUS OF THE UPLOAD, change them!
    		 *
    		 */
    
    		if (!is_uploaded_file($file) || ($_FILES['Filedata']['size'] > 2 * 1024 * 1024) )
    		{
    			$error = '400 Bad Request';
    		}
    		if (!$error && !($size = @getimagesize($file)))
    		{
    			$error = '409 Conflict';
    		}
    		if (!$error && !in_array($size[2], array(1, 2, 3, 7, 8) ) )
    		{
    			$error = '415 Unsupported Media Type';
    		}
    		if (!$error && ($size[0] < 25) || ($size[1] < 25))
    		{
    			$error = '417 Expectation Failed';
    		}
    
    		/**
    		 * This simply writes a log entry
    		 */
    		fputs($log, ($error ? 'FAILED' : 'SUCCESS') . ' - ' . gethostbyaddr($_SERVER['REMOTE_ADDR']) . ": {$_FILES[Filedata][name]} - {$_FILES[Filedata][size]} byte \n" );
    		fclose($log);
    
    		if ($error)
    		{
    			/**
    			 * ERROR DURING UPLOAD, one of the validators failed
    			 * 
    			 * see FancyUpload.js - onError for header handling
    			 */
    			header('HTTP/1.0 ' . $error);
    			die('Error ' . $error);
    		}
    		else
    		{
    			/**
    			 * UPLOAD SUCCESSFULL AND VALID
    			 *
    			 * Use move_uploaded_file here to save the uploaded file in your directory
    			 */
    
    		}
    
    		die('Upload Successfull');
    
    	}
    ?>
    PHP:
    tell how can modify it to enter destination link not to upload
     
    phpx, Jan 18, 2010 IP