Gazzo
10-04-2001, 11:27 AM
Hi can anybody help please,
I am working on a file upload component for an ASP page, I have this working with only one problem, and that is when I upload a jpg, bmp or gif file. The data that I am working with is stored in unicode format and I want to write it to a file.
I am having problems with this and as my server is in the next room, and everytime I make a change to the component dll I have to go next door and stop the services, re-register it etc.
Therefore I have decided to get this part working in a simple VB program first. I tried doing the following but with no success:
Private Sub cmd_Read_Click()
Dim hfile As Long
Dim x As Variant
Dim i As Long
hfile = FreeFile
Open txtFile For Binary Access Read As hfile
hfile2 = FreeFile
Open "C:\TestData.jpg" For Binary Access Write As hfile2
Do Until EOF(hfile)
i = i + 1
Get hfile, i, x
Put hfile2, i, x
Loop
Close hfile
Close hfile2
End Sub
It successfully creates a testdata.jpg file but the data is not the same as in the original file therefore is cannot recognise it as a jpg.
Can anyone tell me how to copy a jpg file byte by byte into a newly created file, which can then be opened as a jpg.
Thanks,
Gazzo.
I am working on a file upload component for an ASP page, I have this working with only one problem, and that is when I upload a jpg, bmp or gif file. The data that I am working with is stored in unicode format and I want to write it to a file.
I am having problems with this and as my server is in the next room, and everytime I make a change to the component dll I have to go next door and stop the services, re-register it etc.
Therefore I have decided to get this part working in a simple VB program first. I tried doing the following but with no success:
Private Sub cmd_Read_Click()
Dim hfile As Long
Dim x As Variant
Dim i As Long
hfile = FreeFile
Open txtFile For Binary Access Read As hfile
hfile2 = FreeFile
Open "C:\TestData.jpg" For Binary Access Write As hfile2
Do Until EOF(hfile)
i = i + 1
Get hfile, i, x
Put hfile2, i, x
Loop
Close hfile
Close hfile2
End Sub
It successfully creates a testdata.jpg file but the data is not the same as in the original file therefore is cannot recognise it as a jpg.
Can anyone tell me how to copy a jpg file byte by byte into a newly created file, which can then be opened as a jpg.
Thanks,
Gazzo.