HEY HANG... I HAVE BEEN USING PHP FORMGEN FOR A WHILE AND AND HAVE GOTTEN THE HANG OF THE BASICS.
I AM MAKING AN UPLOAD PORTAL USING PHPFORMGEN. I GOT IT SETUP WHERE USERS CAN UPLOAD A FILE AND PICK THE CATEGORY THE CONTENT IS (I.E. AUDIO, VIDEO, ETC.) I FOUND THE AREA IN PROCESS.PHP WHERE IT TELLS WHAT FOLDER SEND FILES TO, BUT I DONT HOW TO REWRITE THE PHP CODE SO IT CAN GO TO SUB-FOLDERS I ALREADY HAVE CREATED IN THE PHPFORMGEN FOLDER LOCATION
RIGHT NOW, WHEN I UPLOAD IT SENDS FILES TO: ...FILES/
I HAVE SUB-FOLDERS MADE IN "FILES/" SECTION (files/rap/, files/rock/, etc.)
i want to edit my process.php so that files selected as "rap" in drop down list within form will go to "files/rap/" folder, and items selected as "rock" will go to "files/rock/" folder, so on and so on...
if any one has the script i would need already done, please reply with or throw me a bone on how to do it
i can make it cheezy and have the genre a pre selection so they can be taken to a different form with a different porcess.php to point to but it would be really lame
i want to change the destination of the uploaded file based on the category selected, here are my lists of categories
here is process.php i have now, i see where it tells form destination to send files to, but i dont know how to tell it to send to a different file folder based on selected category in form
<?php
include("global.inc.php");
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
$File=$HTTP_POST_FILES['File'];
pt_register('POST','MatureMaterial');
pt_register('POST','Notes');
$Notes=preg_replace("/(\015\012)|(\015)|(\012)/"," <br />", $Notes);pt_register('POST','Category');
pt_register('POST','Terms');
pt_register('POST','date');
pt_register('POST','ip');
pt_register('POST','browser');
if($File=="" || $Notes=="" || $Terms=="" ){
$errors=1;
$error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
}
if(!is_uploaded_file($HTTP_POST_FILES['File']['tmp_name'])){
$error.="<li>The file, ".$HTTP_POST_FILES['File']['name'].", was not uploaded!";
$errors=1;
}
$date = date("l jS of F Y h:i:s A");
$ip = $HTTP_SERVER_VARS["REMOTE_ADDR"];
$browser = $HTTP_SERVER_VARS["HTTP_USER_AGENT"];
if($errors==1) echo $error;
else{
$image_part = date("h_i_s")."_".$HTTP_POST_FILES['File']['name'];
$image_list[0] = $image_part;
copy($HTTP_POST_FILES['File']['tmp_name'], "files/".$image_part);
$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
$message="File: ".$where_form_is."files/".$image_list[0]."
Mature Material: ".$MatureMaterial."
Notes: ".$Notes."
Category: ".$Category."
Terms: ".$Terms."
date: ".$date."
ip: ".$ip."
browser: ".$browser."
";
$message = stripslashes($message);
mail("mail@clhmedia.com","Form Submitted at your website",$message,"From: phpFormGenerator");
$make=fopen("admin/data.dat","a");
$to_put="";
$to_put .= $where_form_is."files/".$image_list[0]."|".$MatureMaterial."|".$Notes."|".$Category."|".$Terms."|".$date."|".$ip."|".$browser."
";
fwrite($make,$to_put);
ive been patching a lot of stuff together to make this site, let me know what you think
any comments, or reccomendations are greatly appreciated
i hate registering with sites, so i made this one registration free for the moment. you can upload video and audio without giving the site your name , blood type, and next of kin lol
thansk again guys, that was a super fast responce and i got in goin in minutes
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
HEY HANG... I HAVE BEEN USING PHP FORMGEN FOR A WHILE AND AND HAVE GOTTEN THE HANG OF THE BASICS.
I AM MAKING AN UPLOAD PORTAL USING PHPFORMGEN. I GOT IT SETUP WHERE USERS CAN UPLOAD A FILE AND PICK THE CATEGORY THE CONTENT IS (I.E. AUDIO, VIDEO, ETC.) I FOUND THE AREA IN PROCESS.PHP WHERE IT TELLS WHAT FOLDER SEND FILES TO, BUT I DONT HOW TO REWRITE THE PHP CODE SO IT CAN GO TO SUB-FOLDERS I ALREADY HAVE CREATED IN THE PHPFORMGEN FOLDER LOCATION
RIGHT NOW, WHEN I UPLOAD IT SENDS FILES TO: ...FILES/
I HAVE SUB-FOLDERS MADE IN "FILES/" SECTION (files/rap/, files/rock/, etc.)
i want to edit my process.php so that files selected as "rap" in drop down list within form will go to "files/rap/" folder, and items selected as "rock" will go to "files/rock/" folder, so on and so on...
if any one has the script i would need already done, please reply with or throw me a bone on how to do it
i can make it cheezy and have the genre a pre selection so they can be taken to a different form with a different porcess.php to point to but it would be really lame
i want to change the destination of the uploaded file based on the category selected, here are my lists of categories
<select name='Category'>
<option value='House / Progressive'>House / Progressive
<option value='Techno / Hardcore'>Techno / Hardcore
<option value='Jungle / Tribal'>Jungle / Tribal
<option value='Trance / Electro'>Trance / Electro
<option value='Jazz / Soul'>Jazz / Soul
<option value='Rock / Pop'>Rock / Pop
<option value='Rap / Hip-Hop'>Rap / Hip-Hop
<option value='Loop / Clip'>Loop / Clip
<option value='Other / Misc'>Other / Misc
</select><br />
i want to change the destination of the uploaded file based on the category selected, here are my list of subfolders
files/house_progressive/
files/techno_hardcore/
files/jazz_soul/
files/trance_electro/
files/jungle_tribal/
files/rock_pop/
files/rap_hiphop/
files/loops_clips/
files/other_misc/
here is process.php i have now, i see where it tells form destination to send files to, but i dont know how to tell it to send to a different file folder based on selected category in form
<?php
include("global.inc.php");
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
$File=$HTTP_POST_FILES['File'];
pt_register('POST','MatureMaterial');
pt_register('POST','Notes');
$Notes=preg_replace("/(\015\012)|(\015)|(\012)/"," <br />", $Notes);pt_register('POST','Category');
pt_register('POST','Terms');
pt_register('POST','date');
pt_register('POST','ip');
pt_register('POST','browser');
if($File=="" || $Notes=="" || $Terms=="" ){
$errors=1;
$error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
}
if(!is_uploaded_file($HTTP_POST_FILES['File']['tmp_name'])){
$error.="<li>The file, ".$HTTP_POST_FILES['File']['name'].", was not uploaded!";
$errors=1;
}
$date = date("l jS of F Y h:i:s A");
$ip = $HTTP_SERVER_VARS["REMOTE_ADDR"];
$browser = $HTTP_SERVER_VARS["HTTP_USER_AGENT"];
if($errors==1) echo $error;
else{
$image_part = date("h_i_s")."_".$HTTP_POST_FILES['File']['name'];
$image_list[0] = $image_part;
copy($HTTP_POST_FILES['File']['tmp_name'], "files/".$image_part);
$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
$message="File: ".$where_form_is."files/".$image_list[0]."
Mature Material: ".$MatureMaterial."
Notes: ".$Notes."
Category: ".$Category."
Terms: ".$Terms."
date: ".$date."
ip: ".$ip."
browser: ".$browser."
";
$message = stripslashes($message);
mail("mail@clhmedia.com","Form Submitted at your website",$message,"From: phpFormGenerator");
$make=fopen("admin/data.dat","a");
$to_put="";
$to_put .= $where_form_is."files/".$image_list[0]."|".$MatureMaterial."|".$Notes."|".$Category."|".$Terms."|".$date."|".$ip."|".$browser."
";
fwrite($make,$to_put);
header("Refresh: 0;url=http://clhmedia.com/proto/confirm_audio.html");
?><?php
}
?>
if it is also any help, here is where the form is currently located:
http://clhmedia.com/media/forms/upload_audio.html
hope this is everything, i could really use the help
Take this portion of the process.php file:
$image_list[0] = $image_part;
copy($HTTP_POST_FILES['File']['tmp_name'], "files/".$image_part);
And change to:
$image_list[0] = $image_part;
if($Category == "House / Progressive") {
$path="files/house_progressive/";
} else if ($Category == "Techno / Hardcore") {
$path="files/techno_hardcore/";
} else if ($Category == "Jungle / Tribal") {
$path="files/jazz_soul/";
} else {
$path="files/";
}
copy($HTTP_POST_FILES['File']['tmp_name'], $path.$image_part);
Get the idea?
...worked like a charm. you rock TNT
i was hoping to use similar functions for an image uploader, now i can do it in a snap
thanks gain
anyone ineterested in uploading and sharing their audio and video files, feel free to check out my site
www.clhmedia.com
http://clhmedia.com/proto/my_audio.html
http://clhmedia.com/proto/my_video.html
mail@clhmedia.com tripper.jones@yahoo.com
ive been patching a lot of stuff together to make this site, let me know what you think
any comments, or reccomendations are greatly appreciated
i hate registering with sites, so i made this one registration free for the moment. you can upload video and audio without giving the site your name , blood type, and next of kin lol
thansk again guys, that was a super fast responce and i got in goin in minutes