28, May 2012

easy upload and download need help! - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Easy PHP Upload (Moderator: Olaf)
Topic: easy upload and download need help!
« previous next »
Pages: [1] 2 Print
Instabuck - The easy way to sell digital products online

Author Topic: easy upload and download need help!  (Read 5000 times)
Metal slug addict
*
Posts: 19
118 credits
Members referred : 0


« on: Apr 20, 2007, 05:09:30 am »

ive downloaded easy upload php, ive confgured the mulitple file upload php to my needs. im a newbie. i wanted my easy upload to look the same as it was together with the drop down menu directory. can someone help me
« Last Edit: Apr 20, 2007, 12:32:31 pm by Olaf »
aka J Love
Community Supporter ?
Bill Gates is my home boy
*****
Gender: Male
Posts: 886
1148 credits
Members referred : 4



Re: easy upload dilema
« Reply #1 on: Apr 20, 2007, 07:26:40 am »

you aren't really stating what your problem is, we wont be able to help unless you give a better description and maybe some code snippets


Last blog : phpHaze 1.59.1 in Development
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #2 on: Apr 20, 2007, 07:38:42 am »

ive downloaded easy upload php, ive confgured the mulitple file upload php to my needs. im a newbie. i wanted my easy upload to look the same as it was together with the drop down menu directory. can someone help me
Hi,

this drop down is not part of the upload class, its a combination several scripts, check here:

@Method, if you know the scripts its much mire clear too answer Wink

Metal slug addict
*
Posts: 19
118 credits
Members referred : 0


« Reply #3 on: Apr 20, 2007, 09:22:41 am »

hehehe sorry i think thats the problem with newbies they tend to talk and talk without stating the facts. sorry. the problem, ive downloaded easy php upload at php scripts and classes. i like its appearance in the demo script (the upload function and download functions). what im trying to get at is use the download function in my own site too. the link to php.net doesnt point to such script. and additional, the scirpt i used for the easy php upload demo is the multiple file upload. how can i make my upload & download site look exactly in the php scripts and classes site. "UPLOAD FUNCTION AND DOWNLOAD FUNCTION" visible in my page. hope this is clear i pray  Smiley thanks and more power
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #4 on: Apr 20, 2007, 09:32:19 am »

hehehe sorry i think thats the problem with newbies they tend to talk and talk without stating the facts. sorry. the problem, ive downloaded easy php upload at php scripts and classes. i like its appearance in the demo script (the upload function and download functions). what im trying to get at is use the download function in my own site too. the link to php.net doesnt point to such script. and additional, the scirpt i used for the easy php upload demo is the multiple file upload. how can i make my upload & download site look exactly in the php scripts and classes site. "UPLOAD FUNCTION AND DOWNLOAD FUNCTION" visible in my page. hope this is clear i pray  Smiley thanks and more power

as I posted in the other thread, its a combination of 3 scripts, because of security reasons I can't show you the code from my demopage

Metal slug addict
*
Posts: 19
118 credits
Members referred : 0


« Reply #5 on: Apr 20, 2007, 09:36:55 am »

Maybe you can email it to me. kimusabe007@yahoo.com, i really love to use the script on my page. or you can teach me pls. thanks
Metal slug addict
*
Posts: 19
118 credits
Members referred : 0


« Reply #6 on: Apr 20, 2007, 09:52:10 am »

what do you mean "combination"? of a class and 3 sniplets? what ive done so far is created a .php page and <? include upload_example.php on it. It appeared well and i been able to upload files. the problem is i also wanted the download function and open directory function to appear on the .php ive created.   Smiley thanks
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #7 on: Apr 20, 2007, 09:59:52 am »

Do you have any PHP knowledge?

maybe you need to try some beginners tutorial first

Metal slug addict
*
Posts: 19
118 credits
Members referred : 0


« Reply #8 on: Apr 20, 2007, 10:31:35 am »

im really a newbie im really sorry for annoying you. i really wanted to explore this script for my page to look good but it seems that your holding back in helping me. ill just have to play around with it anyway. dont know any php thats why i seeking help in this forum. thanks and more power Smiley
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #9 on: Apr 20, 2007, 11:19:03 am »

im really a newbie im really sorry for annoying you. i really wanted to explore this script for my page to look good but it seems that your holding back in helping me. ill just have to play around with it anyway. dont know any php thats why i seeking help in this forum. thanks and more power Smiley
helping people doesn't mean give everything for free what someone has asked (next time you will ask me for a copy of my website Smiley), you got my script (for free) and you didn't showed me the code where you have a problem. If you can show me the code I will try to locate the problem.

DON'T POST the code I have already provided, but it's not a shame PHP web development is a profession (same like web design), you can't lean that by downloading a script...

Metal slug addict
*
Posts: 19
118 credits
Members referred : 0


« Reply #10 on: Apr 20, 2007, 11:34:16 am »

 Grin no that is not the case i really appreciate the code you have provided for free. the easy upload php doesnt have a problem for me, and its been working perfectly in my site. all i want is the download and open directory function which i saw in your script demo page. honestly i dont know where to start? Embarrassed no errors in the scipt thank again for your patience
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #11 on: Apr 20, 2007, 12:31:23 pm »

Grin no that is not the case i really appreciate the code you have provided for free. the easy upload php doesnt have a problem for me, and its been working perfectly in my site. all i want is the download and open directory function which i saw in your script demo page. honestly i dont know where to start? Embarrassed no errors in the scipt thank again for your patience

start with the open directory function to get the select working

Metal slug addict
*
Posts: 19
118 credits
Members referred : 0


« Reply #12 on: Apr 23, 2007, 03:15:14 am »

ok ive put the open directory code in my site... but its blank on my web browser Cry
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #13 on: Apr 23, 2007, 09:25:53 am »

ok ive put the open directory code in my site... but its blank on my web browser Cry
enable error reporting...

Metal slug addict
*
Posts: 19
118 credits
Members referred : 0


« Reply #14 on: Apr 23, 2007, 10:43:52 am »

where is that? here is the code: download.php

<?php
function select_files($dir, $label = "", $select_name, $curr_val = "", $char_length = 30) {
    $teller = 0;
    if ($handle = opendir($dir)) {
        $mydir = ($label != "") ? "<label for=\"".$select_name."\">".$label."</label>\n" : "";
        $mydir .= "<select name=\"".$select_name."\">\n";
        $curr_val = (isset($_REQUEST[$select_name])) ? $_REQUEST[$select_name] : $curr_val;
        $mydir .= ($curr_val == "") ? "  <option value=\"\" selected>...\n" : "<option value=\"\">...\n";
        while (false !== ($file = readdir($handle))) {
            $files[] = $file;
        }
        closedir($handle);
        sort($files);
        foreach ($files as $val) {
            if (is_file($dir.$val)) { // show only real files (ver. 1.01)
                $mydir .= "    <option value=\"".$val."\"";
                $mydir .= ($val == $curr_val) ? " selected>" : ">";
                $mydir .= (strlen($val) > $char_length) ? substr($val, 0, $char_length)."...\n" : $val."\n";
                $teller++;   
            }
        }
        $mydir .= "</select>";
    }
    if ($teller == 0) {
        $mydir = "No files!";
    } else {
        return $mydir;
    }
}

// example: echo select_files("path_to_your_folder");
?>

then on my directory.php file i put this <? include("home/download.php");?> thanks

the main file which adapts to my site is directory.php, within directory.php is the <? include statement which points to download.php. im i on the right track?
« Last Edit: Apr 23, 2007, 10:50:09 am by andoy »
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #15 on: Apr 23, 2007, 11:45:52 am »

remove this to see a result

// example:

Metal slug addict
*
Posts: 19
118 credits
Members referred : 0


« Reply #16 on: Apr 24, 2007, 02:03:51 am »

done! removed it. this is the error:

Warning: Missing argument 3 for select_files() in /var/www/html/upload_class/directory.php on line 3

Warning: OpenDir: No such file or directory (errno 2) in /var/www/html/upload_class/directory.php on line 5
Metal slug addict
*
Posts: 19
118 credits
Members referred : 0


« Reply #17 on: Apr 24, 2007, 02:21:24 am »

error 2 is gone i have the directory and drop down box visible now. Grin
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #18 on: Apr 24, 2007, 07:13:26 am »

error 2 is gone i have the directory and drop down box visible now. Grin

ok then next you need somthing like

Code:
<?php
if (!empty($_REQUEST['selectfoldername'])) {
$path $_SERVER['DOCUMENT_ROOT']."/path2file/"// play with the path if the document root does noet exist
$fullPath $path.$_GET['selectfoldername'];

if (
$fd fopen ($fullPath"r")) {
    
$fsize filesize($fullPath);
    
$path_parts pathinfo($fullPath);
    
$ext strtolower($path_parts["extension"]);
    switch (
$ext) {
        case 
"pdf":
        
header("Content-type: application/pdf"); // add here more headers for diff. extensions
        
header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\""); // use 'attachement' to force a download
        
break;
        default;
        
header("Content-type: application/octet-stream");
        
header("Content-Disposition: filename=\"".$path_parts["basename"]."\"");
    }
    
header("Content-length: $fsize");
    
header("Cache-control: private"); //use this to open files directly
    
while(!feof($fd)) {
        
$buffer fread($fd2048);
        echo 
$buffer;
    }
}
fclose ($fd);
exit;
}

this code should be before any html code and you need to change some variables

Metal slug addict
*
Posts: 19
118 credits
Members referred : 0


« Reply #19 on: Apr 24, 2007, 08:52:55 am »

done! but its a blank page. ive named it ex.php. ive change the path2file to my needs but its blank
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=6415
Tags : easy upload php Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] 2 Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Easy PHP Upload (Moderator: Olaf)
Topic: easy upload and download need help!
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 08:33:57 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.