Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 532
  • Last Modified:

"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?
0
stewboy
Asked:
stewboy
1 Solution
 
Saqib KhanSenior DeveloperCommented:
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.
0
 
Saqib KhanSenior DeveloperCommented:
> 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.
0
 
stewboyAuthor Commented:
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?
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
Saqib KhanSenior DeveloperCommented:
Thanks for Clearification.
Thats not quite possible because of Security Reasons.
0
 
shoeman22Commented:
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
0
 
Saqib KhanSenior DeveloperCommented:
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.
0
 
SpazMODicCommented:
PAQed, with points refunded (125)

SpazMODic
EE Moderator
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now