473,545 Members | 1,878 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Uploaded files can not be viewed

Hello,
I use this script to upload image files to a folder on a IIS6 server:
*************** **** START UPLOAD.ASPX FILE *************** *******
<%@ Page Language="VB" Debug="true" %>
<%@ Import Namespace="Syst em.IO" %>
<script runat="server">
Sub SubmitButton_Cl ick(Source As Object, e As EventArgs)
If Not (oFile.PostedFi le Is Nothing) Then
Try
'Declare variables
Dim strFileName As String
Dim strFilePath As String
Dim strFolder As String
Dim strPicType As String
Dim strPicSize As String
'Set Upload Folder
strFolder = "D:\Inetpub\www root\upload\"
'Get the name of the file that is posted
strFileName = oFile.PostedFil e.FileName
strFileName = Path.GetFileNam e(strFileName)
strFilePath = strFolder & strFileName
'Validate that it is an image file
strPicType = oFile.PostedFil e.ContentType
strPicSize = oFile.PostedFil e.ContentLength
If (strPicType="im age/jpeg" or strPicType="ima ge/gif" or
strPicType="ima ge/pjpeg" or strPicType="ima ge/bmp") then
'Save file
oFile.PostedFil e.SaveAs(strFil **ePath)
Span.InnerHtml = "De afbeelding werd succesvol
bewaard!<BR><IM G SRC='http://www.a-random-website.co**m/upload/" &
strFileName & "'><BR>" & strPicSize & "."
Else
Span.InnerHtml = "De afbeelding is niet van het formaat

GIF, JPG,
JPEG of BMP!"
End If
Catch ex As Exception
Span.InnerHtml = "Er is een fout opgetreden bij het
bewaren van de afbeelding. Probeer het eens opnieuw."
End Try
End If
End Sub
</script>
<html>
<head>
<title>Title</title>
</head>
<body>
<FONT FACE="Trebuchet MS, Arial, Helvetica, Verdana" SIZE="2"
COLOR="#4E69B0" >
<form runat="server" enctype="multip art/form-data">
Selecteer de afbeelding die je wenst toe te voegen:<br />
<input type="file" id="oFile" runat="Server"> <br/>
<input type="submit" id="Submit" runat="Server"
value="Upload File" OnServerClick=" SubmitButton_Cl **ick">
<p>
<span id="Span" runat="Server" />
</form>
</FONT>
</body>
</html>
*************** **** END UPLOAD.ASPX FILE *************** *******
The folder where the images are uploaded to is called upload and
located in the wwwroot folder (D:\Inetpub\www root\upload\). I assigned
write permission to it to be able to save file via script.
This script is working and the file is uploaded correctly. But when I
then want to view the uploaded image using the webbrowser, I am
prompted to logon using windows security.
When I upload an image to the same upload folder
(D:\Inetpub\www root\upload\) using FTP then I can see the image without

being prompted to logon. It seems that it has nothing to do with the
security on the folder, but with the security set on the saved file
using the ASP.NET script.
Who can help me out? What is wrong, do I use a wrong method or can I
set security on the saved file?
Already thanks for your help!

Nov 23 '05 #1
0 1202

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2601
by: geradeaus | last post by:
Even if you upload an image partially with ftp software, you can still read the image. Only the image will be partially gray. So, can I determine with a php-function if an image is fully uploaded on the server and without checking the filesize using an interval in time? To be completely clear : this isn't about http-upload, but about...
1
1611
by: Murugavel | last post by:
Hi all, Now,we stored uploaded files into our webserver(where the place our site is running) by normal upload function ASP.NET ,but we brought a new server for keeping files. How Can we moving the uploaded files to other server (consider as FileServer) from our application Server(Web Server). Can any one give simple solution,
5
2719
by: IkBenHet | last post by:
Hello, I use this script to upload image files to a folder on a IIS6 server: ******************* START UPLOAD.ASPX FILE ********************** <%@ Page Language="VB" Debug="true" %>
0
776
by: IkBenHet | last post by:
Hello, I use this script to upload image files to a folder on a IIS6 server: ******************* START UPLOAD.ASPX FILE ********************** <%@ Page Language="VB" Debug="true" %>
6
4320
by: Kimmo Laine | last post by:
Running IIS 6 on Windows 2003 server. After an update to the most recent version of php 5.1.2, for some reacon a function handling uploaded files using is_file stopped working. is_file failed for existing files. I fixed it by changing is_file to file_exists, then it worked again. Prior to the update, in the older version, presumably it was...
4
1393
by: sameer | last post by:
Hi all, my asp.net page lets the users uploads documents up to a folder on the webserver and then shows hyperlinks on a page pointing to these documents so that the user can click them open and all this is only for users logged in only. But the problem is that ones the user sees the name and part of the document they are able to browse to...
14
2786
by: =?Utf-8?B?U2FtdWVs?= | last post by:
Hi, I have a web app that allows others to upload files, and the problem is that if I allow users to upload image files, fake image can be uploaded and cause XSS issues. In the app, I do check image dimension when uploaded so that any fake image that is actually a text file is blocked (user renames a .txt to .gif, e.g.). However, a png...
14
1829
by: Jeigh | last post by:
Hello, I'm going to start making a script that will allow users to upload a file, then re download it later. I'll basically be doing the following: - The uploaded file will be given a string of random numbers / letters as the filename and uploaded to a folder. - That random file name will be stored in the database along with the users...
2
1095
by: Adela Arpitha | last post by:
Hi, i'm using asp.net 1.1 for my project. I have a written a c# code where the user can upload his files through the file upload component which gets uploaded to the specified path in a local disk and these files are viewed on the user screen application using the concept of fetching files from the local drive. I have taken a table to...
0
7486
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7932
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7776
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6001
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4965
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3473
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3456
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1905
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1032
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.