Link to home
Start Free TrialLog in
Avatar of stewboy
stewboy

asked on

"File Field" form element not working (ASP.VB/MS Access)

I have a record insertion page that allows the user to input the date on which a MS Word document was created. I want the user to also insert a hyperlink to this document, which resides on the same server as the web site and database.

Rather than making them hand-code the link, I'd like them to be able to "browse" for it from the record insertion page, and once the page submits the hyperlink will be in the database.

I'm trying to use the "file field" form element from the DW form behaviors, but as soon as I put the "file field" in, the form no longer submits. If I just have the date text field, the form populates the database with the date. As soon as I put the file field in, the form no longer submits. I don't even have any insert behavior assoviated with it - just the act of putting it in the form causes the form to no longer work.

Help?
Avatar of Saqib Khan
Saqib Khan
Flag of United States of America image

stewboy You cant just use the FILE field like this.

file field is good if you want to UPLOAD files to your server into a Specific Folder AND you have 3rd Party Component's installed on your Server to accept file Field Upload. http://aspUpload.com is a good website to learn about using File upload's.

if you want your users to input the URL then let them Type it, thats the Best solution without using Filefield. otherwise get the Component to accpet file upload's.
> I posted this question, but it makes no sense, and no one will be able to provide me with a logical, working answer.

stewboy what do you mean by it makes no sense?
I gave you the Answer to your question, that you trying to do something and its not quit possible, if you think you are confused OR you think i am wrong then please continue the Post to ask more questions about your problem.
Avatar of stewboy
stewboy

ASKER

Not trying to duck you adilkhan. I asked to have it pulled before I  saw that you had posted a Comment. The reason I asked for it to be pulled is that I'm trying to use the file field for something it's not designed to do.

I'm looking for a way that a user can browse for the location of a document, and then input that link to the database, where it will reside as a hyperlink. What the file field button is doing, at least superficially, is exactly what I want.  I don't actually want the file to be uploaded, just the link information.

However, just because I want it to do something doesn't mean it actually will.

Can you help me find another way to allow user "browsing" for a file location?
Thanks for Clearification.
Thats not quite possible because of Security Reasons.
I haven't tested this out, but it may work:
The idea is that you can use the <input type="file"> element to display the location of the file, then, when you submit the form, you can trigger a JavaScript function to pass the text value from the "file" input box into a "hidden" field.

Then, when you submit it to the server, you will be able to reference the hidden field, containing the url of the "file" field, just like you would any other text field.
--------------------------------------------------------------------------------------------
<script language="javaScript">
function setHidden(theFileField,theFileName) {
     theFileName.value=theFileField.value;
}
</script>


<form action="form.asp method="post" name="myForm" onSubmit="setHidden(this.myFile,this.myFileName);">
<input type="file" id="myFile" name="myFile">
<input type="hidden" id="myFileName" name="myFileName">
<input type="submit">
</form>

--------------------------------------------------------------------------------------------
Let me know if you need any more help,
shoeman22
shoeman22 I know what you mean.
But the Problem is FILE field has many Security Issues, You can not set the Value of the Hidden Field from the File field VIA Client Side Language such as javaScript.
ASKER CERTIFIED SOLUTION
Avatar of SpazMODic
SpazMODic

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial