Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

viewing uploaded files in coldfusion 1

Status
Not open for further replies.

rninja

Technical User
Apr 11, 2001
381
0
0
US
I made a script that allows a user to upload a file to the server, but I want the server to be aable to show picture files that were uploaded in a nice format... how would I go about doing this?


Thanks in advance!!!


Rninja
 
Hey rninja,

I'm not sure I understand your question. Do you want the visitor to see the files after they are uploaded or do you mean you want the server to display them later such as in thumbnail page?

GJ
 
if possible both situations!

Thanks!


Rninja
 
Hey Rninja,

Assuming you're uploading the files to the same directory as the script, something like <cfoutput><img src=&quot;#cffile.serverfile#&quot;></cfoutput> should allow them to see what they uploaded. As far as a thumbnail page goes, you'll need to store the name of the file in a database and then retrieve it for your thumbnails page. The code above would work in this case as long as you change &quot;cffile&quot; to your query name.

Am I missing something? I feel like I'm technically answering your question when you're really looking for something else.

Good luck,
GJ
 
Actually, that is great! It's the code bit I need. I can work it from here. Thanks Gunjack!


Rninja
 
I've been trying it out and I cant exactly seem to get it to work. it always comes up empty with an error message. could you make me a small code snippet with the variable being passed as &quot;file1&quot;?

That would be quite helpful, thanks much in advance!


Rninja
 
Here are some code snippets from an application I'm still using. Hope it helps:


<cffile action=&quot;upload&quot;
filefield=&quot;file1&quot;
destination=&quot;C:\InetPub\nameconflict=&quot;overwrite&quot;
>

<cfset auth = #REMOTE_USER#>
<cfset webauthor = mid(auth, 10, 15)>
<cfset created=Now()>
<cfset link=&quot;#file.ServerFile#&quot;>

<cfquery datasource=&quot;Webpublish&quot;>
insert into pubfiles(webauthor, link, created)
values('#webauthor#', '#link#', #created#)
</cfquery>

You can then display a link to your image, or the image itself, using:

<img src=&quot;files/#link#&quot;>

or

<a href=&quot;files/#link#&quot;>Link to Image</a>

By querying up #link#.



John Hoarty
jhoarty@quickestore.com
 
Hey rninja,

Did you get this to work? I've been real busy and didn't get a chance to look at it again. Let me know if you still need help and I'll try to create you a quick code snippet.

GJ
 
I did get the basic script to work, but I wanted to try using the database to show thumbnails of all uploaded images, however, I cannot get the myodbc or merant mysql drivers in linux to work with coldfusion5, and no one seems to know how to fix it.

If you could help me diagnose that, I would be really greatful! Using MyODBC driver I get a IM03 error : Specified driver could not be loaded.

Got an idea about this? Maybe you could explain how you installed it?


Thanks much in advance!

}Rninja
 
To change the format of your uploaded image, u can use the <cfx_pwimageproc> tag. With this, u can resize the image as u want and things like that.

<cfx_pwimageproc infile=&quot;c:\test\images\#MyImage#&quot; set_width=&quot;65&quot; set_height=&quot;45&quot;>
 
Hey rninja,

I've never run CF on anything but NT so I don't really have any experience in that area. I did a quick search on the Allaire Forums but didn't turn up anything there specific to your situation. You might want to spend some time going through their forums as there seems to be a lot of info on CF5/db connection problems.

Good luck,
GJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top