View Full Version : godaddy gdform.php file upload extra code required

01-13-2008, 08:52 AM
hi...first, i'm a complete dunce! and new to making websites.
i have a form on my website hosted on godaddy that i have managed to get working just fine using the gdform.php

however i want to be able to receive attachments/files from the form. i put the form together but i only received the text input, no files.

i contacted godaddy and they said the gdform.php doesn't handle file uploads and that i need more code to enable this function on my form, and they suggested i browse the internet to find help...i know, great customer support!

so that's why i'm here, has anyone run into this before, how do i find the code i need to allow a user to upload a file to me from my site?
any help would be much appreciated!!!
all the best

01-13-2008, 09:51 AM
godaddy is a hosting service, and are not really obligated to provide you with program code, so I don't think that they are providing you poor customer service ;)
As for uploading, you need to simply create a form, that must be of a post method, encoded with multipart/form-data (someone correct me if this is wrong, I'm writing this on the fly and am too lazy to double check it :P). So like so:

<form name="myFrm" id="myFrm" method="post" enctype="multipart/form-data" action="uploadFile.php">
<label for="uploadFile">Upload a file</label>
<input type="file" name="uploadFile" id="uploadFile" />
<input type="submit" value="Upload" />

Form file submissions can be retrieved from the _FILES superglobal:

$uploadFile = $_FILES['uploadFile']['tmp_name'];

Check on the php site, http://ca3.php.net/manual/en/features.file-upload.php for information about what is stored in the _FILES hash.

01-13-2008, 01:10 PM
Just a slight word of caution...you're not going to want to allow just anybody to be able to upload files to your site b/c some malicious people may upload something to take over your complete site. So if, you aren't requiring a log in for users or something I'd suggest not allowing random people the privilege of uploading.

01-13-2008, 09:35 PM
Go-daddy allows you to create password protected directories, i would suggest creating one and putting the file uploader there. Then only you have access to it. :)