webform
10-04-2007, 12:01 AM
heya all!
Here is an example HTML form that I would like to use... very similar to the one I am currently using, but with some wish list features added, or at least an attempt at adding them...
<strong>To upload your site document, please follow the steps listed below.</strong>
<p><br />
<strong>1)</strong> Right click on your site file, and select compress so that your site is sent to a .zip file.
<br />
<strong>2)</strong> Rename the .zip file so that it contains no spaces, and is a single word, followed by .zip.
<br />
<strong>3)</strong> Click on the "Choose File" button to bring up a browser in which you can select your zipped site file.
<br />
<strong>4)</strong> Enter your name, email address and case number.
<br />
<strong>5)</strong> Click on the "Send File" button.
<p><br />
<strong>Make sure that the file uploaded properly before closing the page. There is no need to email us to tell us that the file has been uploaded, as we are automatically alerted, and it is appended to your case file.</strong>
<p><br />
<form enctype="multipart/form-data" action="upload.php" method="POST">
<!-- hidden inputs -->
<input name="TO" type="hidden" value="Email Address Here"></input>
<input name="URL" type="hidden" value="Website Address Here"></input>
<input name="SUBJECT" type="hidden" value="Upload from Case# [[AUTO INSERT CASE NUMBER FROM TEXT FIELD]]"></input><p><br />
<input type="hidden" name="MAX_FILE_SIZE" value="1000000"></input>
Choose a file to upload: <input name="uploadedfile" type="file"></input></p>
<p><br />
<!-- visible inputs -->
Your Name: <input name="name" size="42"></input></p>
<p><br />
Email Address: <input name="Email" size="39"></input></p>
<p><br />
Case Number: <input name="Case Number" size="40"></input></p>
<p><br />
<input type="submit" value="Upload File"></input>
</p>
</form>
This is my upload.php file as it currently exists... and without the features that I would like.
<?php
$target = "upload/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;
//This is our size condition
if ($uploaded_size > 1000000)
{
echo "Your file is too large.<br>";
$ok=0;
}
//This is our limit file type condition
if ($uploaded_type =="text/php")
{
echo "No PHP files<br>";
$ok=0;
}
//Here we check that $ok was not set to 0 by an error
if ($ok==0)
{
Echo "Sorry your file was not uploaded";
}
//If everything is ok we try to upload it
else
{
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ".
basename( $_FILES['uploadedfile']['name']). " has been uploaded";
}
else
{
echo "Sorry, there was a problem uploading your file.";
}
}
?>
Unfortunately, 90% of the time, my current form just says that "Sorry, there was a problem uploading your file", so essentially I am looking for a completely new script.
What I would LIKE to do, is somehow add an additional field to the HTML form for the customer to enter their Case Number. Then, I would like the Case number field to be used with an additional php command to send an email to me with the Case number from the HTML field form as the subject line, and a generated link to the uploaded file as the message.
The link would just be http://myserver.com/filename
Is this possible? Has anyone else tried this or been successful?
Thanks ahead of time....
Here is an example HTML form that I would like to use... very similar to the one I am currently using, but with some wish list features added, or at least an attempt at adding them...
<strong>To upload your site document, please follow the steps listed below.</strong>
<p><br />
<strong>1)</strong> Right click on your site file, and select compress so that your site is sent to a .zip file.
<br />
<strong>2)</strong> Rename the .zip file so that it contains no spaces, and is a single word, followed by .zip.
<br />
<strong>3)</strong> Click on the "Choose File" button to bring up a browser in which you can select your zipped site file.
<br />
<strong>4)</strong> Enter your name, email address and case number.
<br />
<strong>5)</strong> Click on the "Send File" button.
<p><br />
<strong>Make sure that the file uploaded properly before closing the page. There is no need to email us to tell us that the file has been uploaded, as we are automatically alerted, and it is appended to your case file.</strong>
<p><br />
<form enctype="multipart/form-data" action="upload.php" method="POST">
<!-- hidden inputs -->
<input name="TO" type="hidden" value="Email Address Here"></input>
<input name="URL" type="hidden" value="Website Address Here"></input>
<input name="SUBJECT" type="hidden" value="Upload from Case# [[AUTO INSERT CASE NUMBER FROM TEXT FIELD]]"></input><p><br />
<input type="hidden" name="MAX_FILE_SIZE" value="1000000"></input>
Choose a file to upload: <input name="uploadedfile" type="file"></input></p>
<p><br />
<!-- visible inputs -->
Your Name: <input name="name" size="42"></input></p>
<p><br />
Email Address: <input name="Email" size="39"></input></p>
<p><br />
Case Number: <input name="Case Number" size="40"></input></p>
<p><br />
<input type="submit" value="Upload File"></input>
</p>
</form>
This is my upload.php file as it currently exists... and without the features that I would like.
<?php
$target = "upload/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;
//This is our size condition
if ($uploaded_size > 1000000)
{
echo "Your file is too large.<br>";
$ok=0;
}
//This is our limit file type condition
if ($uploaded_type =="text/php")
{
echo "No PHP files<br>";
$ok=0;
}
//Here we check that $ok was not set to 0 by an error
if ($ok==0)
{
Echo "Sorry your file was not uploaded";
}
//If everything is ok we try to upload it
else
{
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ".
basename( $_FILES['uploadedfile']['name']). " has been uploaded";
}
else
{
echo "Sorry, there was a problem uploading your file.";
}
}
?>
Unfortunately, 90% of the time, my current form just says that "Sorry, there was a problem uploading your file", so essentially I am looking for a completely new script.
What I would LIKE to do, is somehow add an additional field to the HTML form for the customer to enter their Case Number. Then, I would like the Case number field to be used with an additional php command to send an email to me with the Case number from the HTML field form as the subject line, and a generated link to the uploaded file as the message.
The link would just be http://myserver.com/filename
Is this possible? Has anyone else tried this or been successful?
Thanks ahead of time....