File upload

Discussion in 'PHP' started by Prakruthi, Jul 7, 2010.

  1. #1
    Hi,
    I want to upload the files remotely, and that files should be stored in the folders depending on date. For example, if i am uploading abc.html on 8th July 2010 it should be stored like this xyz.com/2010/July/8/abc.html, if folder doesn't exists it should be create automatically. Please can any one help me?
     
    Prakruthi, Jul 7, 2010 IP
  2. c_programmer

    c_programmer Peon

    Messages:
    92
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    To create the directories, you need a simple combination of the following functions:
    date()
    mkdir()
    is_dir()

    For uploading, a quick google search found http://www.tizag.com/phpT/fileupload.php
     
    c_programmer, Jul 7, 2010 IP
  3. sgcoder

    sgcoder Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    initially create the URLs as according to year using the date function
    $url = date("Y\m\d");
    PHP:
    there after each time u re uploading the file check the existence of directory..

    
    $date = date(Y\m\d)
    http_build_query(www.site.com\$data)
    
    PHP:
    by getting the date in a string fix the url to upload.... then check for the existence of the URL

    
    function is_valid_url ( $url )
    {
    		$url = parse_url($url);
    
    		if ( ! $url) 
                    {
    			// create the directory taking date string
    		}
                    else
                    // u can upload the file
    
    }
    
    
    PHP:
     
    sgcoder, Jul 7, 2010 IP