Buying Small php upload script edit

Discussion in 'Programming' started by efootball, Feb 14, 2014.

  1. #1
    Hello
    I'm looking for a small update to my image upload script
    Currently the images are uploaded from my computer or url using a custom wordpress template then ran through imagemagick and stored in /reversed/ folder - The update I require is to store the images in public_html/wp-content/uploads/"year"/"month"/"day". as the next part of the script creates a new post in wordpress and attaches the image so I’m wanting the image uploads in the corresponding date folder

    I’m sure this can easily be done using the below code but maybe a built in wordpress function can do this better

    $base_dir = '/public_html/wp-content/uploads';
    $new_dir = $base_dir.date('/Y/m/d/');
    if(!file_exists($new_dir) AND is_writable($base_dir)) {
    mkdir($new_dir, 0777, true)
    }
    Many Thanks
     
    efootball, Feb 14, 2014 IP
  2. Javed iqbal

    Javed iqbal Well-Known Member

    Messages:
    445
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    103
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    Hi,

    How are you add me on sky@pe javed3iqb

    Thanks
     
    Javed iqbal, Feb 14, 2014 IP
  3. Iconiplex

    Iconiplex Member

    Messages:
    119
    Likes Received:
    9
    Best Answers:
    2
    Trophy Points:
    43
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #3
    Feel free to get in touch.
    E-mail:
    Skype/AIM: artizhay
     
    Iconiplex, Feb 15, 2014 IP
  4. OaldDesign

    OaldDesign Active Member

    Messages:
    448
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    60
    As Seller:
    100% - 0
    As Buyer:
    100% - 1
    #4
    Hey i could help if you are still looking for someone
     
    OaldDesign, Feb 17, 2014 IP
  5. loop

    loop Active Member

    Messages:
    519
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    90
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #5
    Must create one by one dir, can't create dir and 2 subdir in same time:

    $base_dir = '/public_html/wp-content/uploads';
    $new_dir_Y = date('Y');
    $new_dir_m = date('m');
    $new_dir_d = date('d');
    if(is_writable($base_dir)) {
    mkdir($base_dir."/".$new_dir_Y, 0777, true);
    mkdir($base_dir."/".$new_dir_Y."/".$new_dir_m, 0777, true);
    mkdir($base_dir."/".$new_dir_Y."/".$new_dir_m."/".$new_dir_d, 0777, true);
    $new_dir=$base_dir."/".$new_dir_Y."/".$new_dir_m."/".$new_dir_d;
    }
     
    loop, Feb 19, 2014 IP
  6. DomainerHelper

    DomainerHelper Well-Known Member

    Messages:
    445
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    100
    As Seller:
    100% - 1
    As Buyer:
    92.3% - 12
    #6
    You could just have your plugin use the built in Wordpress uploader.
     
    DomainerHelper, Feb 20, 2014 IP