Jump to content

Help With Phpformgenerator


rfrassetti

Recommended Posts

Help!

I've just loaded phpformgenerator and am very happy but have 2 questions. First I have made a form to upload files and have tested it successfully but cannot delete the files I have uploaded there. I have tried through my ftp program and through file manager in control panel. I don't want this file to get too large too quickly so will monitor regularly to delete as needed.

 

Second question, does anyone know how to make the script only accept .jpg files in the file upload? Do not want anything other than jpg's being loaded there. Have looked at their forums but they aren't very helpful on this subject.

 

I do not know much (anything) about these type of scripts so any help would be appreciated.

Thanks,

Robert

Link to comment
Share on other sites

You can open a ticket with the help desk and ask them to delete the files. If you are unable to delete them with your FTP program you will have to get the help desk to do it for you each time (don't know how they will like that).

 

As for only accepting .jpg files we would need to see the script to offer suggestions.

Link to comment
Share on other sites

You can open a ticket with the help desk and ask them to delete the files. If you are unable to delete them with your FTP program you will have to get the help desk to do it for you each time (don't know how they will like that).

 

As for only accepting .jpg files we would need to see the script to offer suggestions.

 

Thanks, I have submitted a ticket and hope to get that part settled soon. Below is the code from the form page, hope you can help with this.

Robert

 

<form enctype='multipart/form-data' action='process.php' method='post'>

<table border="1" cellspacing="1" style="border-collapse: collapse" bordercolor="#000066" width="95%" cellpadding="5">

<tr>

<td colspan="3" bgcolor="#B5CBEF" height="17" width="100%" bordercolor="#FFFFFF" background="tile_back.gif">

<p align="left\><b><font face="Verdana" size="2" color="#FFFFFF"><img border="0" src="nav_m.gif" width="8" height="8">

<font face='Verdana' size=2 color='#FFFFFF'><b>

<!- You can add a form title here -->

 

</font><font face="Verdana" size="2" color="#000066"> </font></b></td>

</tr><tr><td colspan="3" bgcolor="#B5CBEF" height="16" width="100%" bordercolor="#FFFFFF" background="tile_sub.gif"><font size="2" face="Verdana"><b><font face="Verdana" size="2" color="#000066">

<!- You can add a brief form description here-->

 

</font></b></font></td></tr><tr><td colspan="3" bgcolor="#D6DFEF" height="16" width="100%" bordercolor="#FFFFFF"><font size="1" face="Verdana">Please fill in all fields marked with a *</font></td></tr><tr><td height="30" width="55" bgcolor="#EFF3F7" bordercolor="#FFFFFF">

<img border="0" src="bc_new.gif" width="28" height="28"></td><td height="30" width="189" bgcolor="#EFF3F7" bordercolor="#FFFFFF">

<font face="Verdana" size="2">Name</td>

<td height="30" width="469" bgcolor="#EFF3F7" bordercolor="#FFFFFF">

<font face="Verdana"><input type=text name='Name'>*</td></tr><tr><td height="30" width="55" bgcolor="#EFF3F7" bordercolor="#FFFFFF">

<img border="0" src="bc_new.gif" width="28" height="28"></td><td height="30" width="189" bgcolor="#EFF3F7" bordercolor="#FFFFFF">

<font face="Verdana" size="2">email</td>

<td height="30" width="469" bgcolor="#EFF3F7" bordercolor="#FFFFFF">

<font face="Verdana"><input type=text name='email'>*</td></tr><tr><td height="30" width="55" bgcolor="#EFF3F7" bordercolor="#FFFFFF">

<img border="0" src="bc_new.gif" width="28" height="28"></td><td height="30" width="189" bgcolor="#EFF3F7" bordercolor="#FFFFFF">

<font face="Verdana" size="2">photo upload</td>

<td height="30" width="469" bgcolor="#EFF3F7" bordercolor="#FFFFFF">

<font face="Verdana"><input type='hidden' name='MAX_FILE_SIZE' value='600000'> <input type='file' name='photoupload'></td></tr><tr><td colspan="3" bgcolor="#B5CBEF" height="25" width="737" background="tile_sub.gif"><p align="center"><font face="Verdana" size="2"><input type=submit value='Submit Form'>               <input type=reset value='Reset Form'></font></td></tr>

</table></form> <br><br><a href='http://phpformgen.sourceforge.net'><img src='button.jpg' border=0></a>

Link to comment
Share on other sites

The code you pasted in is the form itself. The code that would be required to view is the action script "process.php".

 

Told you I dont know much about this! Sorry about that, here is the process.php file:

 

<?php

include("global.inc.php");

$errors=0;

$error="The following errors occured while processing your form input.<ul>";

pt_register('POST','Name');

pt_register('POST','email');

$photoupload=$HTTP_POST_FILES['photoupload'];

if($Name=="" || $email=="" ){

$errors=1;

$error.="<li>You did not enter one or more of the required fields. Please go back and try again.";

}

if($HTTP_POST_FILES['photoupload']['tmp_name']==""){ }

else if(!is_uploaded_file($HTTP_POST_FILES['photoupload']['tmp_name'])){

$error.="<li>The file, ".$HTTP_POST_FILES['photoupload']['name'].", was not uploaded!";

$errors=1;

}

if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email)){

$error.="<li>Invalid email address entered";

$errors=1;

}

if($errors==1) echo $error;

else{

$image_part = date("h_i_s")."_".$HTTP_POST_FILES['photoupload']['name'];

$image_list[2] = $image_part;

copy($HTTP_POST_FILES['photoupload']['tmp_name'], "files/".$image_part);

$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));

$message="Name: ".$Name."

email: ".$email."

photo upload: ".$where_form_is."files/".$image_list[2]."

";

$message = stripslashes($message);

mail("frassetti@hotmail.com","Form Submitted at your website",$message,"From: phpFormGenerator");

 

header("Refresh: 0;url=http://vtours4u.com");

?><?php

}

?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...