Author |
Topic  |
Zuel
Average Member
  
USA
540 Posts |
Posted - 24 June 2007 : 15:32:05
|
I created an upload script from scratch and it works, but it doesn't work. I mean the file gets created, and the information is populated in the file, but when you try to view an image, you get a red x instead of the actual image.
I opened up the original file in notepad, and the new one and the contents seem pretty similar. I haven't beyond compared it but I believe they are equal.
What gives?
I can post the code, but it is quite a bit. |
My Completed Mods: News Mod | Zuel's Avatar Add-on In Development: World of Warcraft Member Roster | [C# Based Forum]
Note - I may take a few days to recieve your email. Hotmail filters all new emails as junk. Would be best to post all questions, concerns in a forum topic to catch my immediate attention. This way others can assist and also correct any similar mistakes.
MSN / E-Mail: ucyimDa_Ruler@Hotmail.com
Personal Bookmarks: How to work a DBS File
|
|
Zuel
Average Member
  
USA
540 Posts |
Posted - 24 June 2007 : 15:34:01
|
quote: Originally posted by Zuel
I created an upload script from scratch and it works, but it doesn't work. I mean the file gets created, and the information is populated in the file, but when you try to view an image, you get a red x instead of the actual image.
I opened up the original file in notepad, and the new one and the contents seem pretty similar. I haven't beyond compared it but I believe they are equal.
What gives?
I can post the code, but it is quite a bit.
As a note, text files are created perfectly. Images aren't working as they should. |
My Completed Mods: News Mod | Zuel's Avatar Add-on In Development: World of Warcraft Member Roster | [C# Based Forum]
Note - I may take a few days to recieve your email. Hotmail filters all new emails as junk. Would be best to post all questions, concerns in a forum topic to catch my immediate attention. This way others can assist and also correct any similar mistakes.
MSN / E-Mail: ucyimDa_Ruler@Hotmail.com
Personal Bookmarks: How to work a DBS File
|
 |
|
AnonJr
Moderator
    
United States
5768 Posts |
Posted - 24 June 2007 : 16:38:30
|
Try using WinMerge to see if they really are the same. Part of the problem may be in the way the script is writing the file to disk. If you can, post a link to a .txt version of the script.
All things being equal, why write your own when there are a number of good, functional scripts out there? |
 |
|
Zuel
Average Member
  
USA
540 Posts |
Posted - 24 June 2007 : 16:55:30
|
quote: Originally posted by AnonJr
Try using WinMerge to see if they really are the same. Part of the problem may be in the way the script is writing the file to disk. If you can, post a link to a .txt version of the script.
All things being equal, why write your own when there are a number of good, functional scripts out there?
Tailoring it towards a mod. Every other script would have needed to be modified anyways and would have came with another copy right. |
My Completed Mods: News Mod | Zuel's Avatar Add-on In Development: World of Warcraft Member Roster | [C# Based Forum]
Note - I may take a few days to recieve your email. Hotmail filters all new emails as junk. Would be best to post all questions, concerns in a forum topic to catch my immediate attention. This way others can assist and also correct any similar mistakes.
MSN / E-Mail: ucyimDa_Ruler@Hotmail.com
Personal Bookmarks: How to work a DBS File
|
 |
|
Zuel
Average Member
  
USA
540 Posts |
Posted - 24 June 2007 : 17:02:44
|
quote: Originally posted by AnonJr
Try using WinMerge to see if they really are the same. Part of the problem may be in the way the script is writing the file to disk. If you can, post a link to a .txt version of the script.
All things being equal, why write your own when there are a number of good, functional scripts out there?
Program said that images are written in binary, binary files cannot be compared.
I saved both images as txt files, then compared them. No difference. |
My Completed Mods: News Mod | Zuel's Avatar Add-on In Development: World of Warcraft Member Roster | [C# Based Forum]
Note - I may take a few days to recieve your email. Hotmail filters all new emails as junk. Would be best to post all questions, concerns in a forum topic to catch my immediate attention. This way others can assist and also correct any similar mistakes.
MSN / E-Mail: ucyimDa_Ruler@Hotmail.com
Personal Bookmarks: How to work a DBS File
|
 |
|
AnonJr
Moderator
    
United States
5768 Posts |
Posted - 24 June 2007 : 17:06:40
|
quote: Originally posted by Zuel
Tailoring it towards a mod. Every other script would have needed to be modified anyways and would have came with another copy right.
Makes sense. Although I don't see why adding another little note in the code would be that big an issue. Most of the scripts I've found just ask that you give them a little credit in the code...
Have you tried putting in the direct URL to the picture and opening it? or tried to download it back again and opening it locally? Just a couple ideas on checking to make sure its really the image that's the problem... |
 |
|
Zuel
Average Member
  
USA
540 Posts |
Posted - 24 June 2007 : 17:17:21
|
quote: Originally posted by AnonJr
Makes sense. Although I don't see why adding another little note in the code would be that big an issue. Most of the scripts I've found just ask that you give them a little credit in the code...
Have you tried putting in the direct URL to the picture and opening it? or tried to download it back again and opening it locally? Just a couple ideas on checking to make sure its really the image that's the problem...
My biggest reason to create my own is to learn how to manage post data and actually using bytes since I've never done it before. Fun and painful but a good learning tool.
The image remains broken everywhere. In explorer the thumbnail doesn't render, in a browser it doesn't render, Office Picture Manager and even photoshop.
My initial guess is that the file's content type is not truly set as an image. I say this because it isn't rendering in any application or browser and if I try to open the image in other applications (Visual Studio) it opens up as code or text. If I try to open the working file in Visual Studio, it redirects me to IE or Microsoft Office Picture Viewer.
While coding this script, I noticed that the content type is pulled from the binary data, but it is never used. Anyone know why that is?
I know you can create files that render as images by setting the mime type of the page but for the original upload script by Richard, that isn't the case. |
My Completed Mods: News Mod | Zuel's Avatar Add-on In Development: World of Warcraft Member Roster | [C# Based Forum]
Note - I may take a few days to recieve your email. Hotmail filters all new emails as junk. Would be best to post all questions, concerns in a forum topic to catch my immediate attention. This way others can assist and also correct any similar mistakes.
MSN / E-Mail: ucyimDa_Ruler@Hotmail.com
Personal Bookmarks: How to work a DBS File
|
Edited by - Zuel on 24 June 2007 17:18:54 |
 |
|
pdrg
Support Moderator
    
United Kingdom
2897 Posts |
Posted - 25 June 2007 : 15:56:28
|
Aren't there different streamwriting methods for binaries and text files? Could that be the problem? |
 |
|
ILLHILL
Junior Member
 
Netherlands
341 Posts |
Posted - 25 June 2007 : 19:56:34
|
Not sure if I'm anywhere near what you mean, but for clppr I work with a caching system that creates cached files in .txt format. I have encountered some bugs, which turned out to be variable settings (0 = unicode, 1 is ascII - or the other way around, since I'm doing this from the top of my head). Anyway, my point is, that a variable somewhere might be wrong which means the image gets written into a different type of .jpg (assuming we're talking jpg's), just the same way my text cache was written as unicode but still remained a .txt file.
No idea if I'm anywhere near, but since your code writes a file and mine does, it might be just a small error along the lines of a variable that might have to be set to true or false or 0 or 1 at least that's what solved the problem for the text files I created, so maybe it's something similar for image files.
Greets, Dominic
|
CLPPR.com - All The News Only Seconds Away |
 |
|
Zuel
Average Member
  
USA
540 Posts |
Posted - 26 June 2007 : 16:02:29
|
I've tried streaming and just writing, both create the file and both don't work.
I've used several examples and I haven't figured it out yet. I'm giving it another attempt using a different method.
I'll see how this one goes. |
My Completed Mods: News Mod | Zuel's Avatar Add-on In Development: World of Warcraft Member Roster | [C# Based Forum]
Note - I may take a few days to recieve your email. Hotmail filters all new emails as junk. Would be best to post all questions, concerns in a forum topic to catch my immediate attention. This way others can assist and also correct any similar mistakes.
MSN / E-Mail: ucyimDa_Ruler@Hotmail.com
Personal Bookmarks: How to work a DBS File
|
 |
|
Zuel
Average Member
  
USA
540 Posts |
Posted - 27 June 2007 : 15:31:16
|
Problem Solved!
Some idiot set the created file to unicode. 
Dim m_FileSys
Set m_FileSys = Server.CreateObject("FileSystemObject")
m_FileSys.CreateTextFile(Path, ForWriting, Unicode)
I had:
m_FileSys.CreateTextFile(Path, 2, True)
After switching the code ran perfectly.
Four days wasted. I shall never make that mistake again. |
My Completed Mods: News Mod | Zuel's Avatar Add-on In Development: World of Warcraft Member Roster | [C# Based Forum]
Note - I may take a few days to recieve your email. Hotmail filters all new emails as junk. Would be best to post all questions, concerns in a forum topic to catch my immediate attention. This way others can assist and also correct any similar mistakes.
MSN / E-Mail: ucyimDa_Ruler@Hotmail.com
Personal Bookmarks: How to work a DBS File
|
 |
|
Zuel
Average Member
  
USA
540 Posts |
Posted - 27 June 2007 : 15:33:31
|
Oh for reference, I switched it too:
m_FileSys.CreateTextFile(Path)
Also, how does know if a file is in unicode or in binary? Is there a specific tag in the file or what? Anyone know? |
My Completed Mods: News Mod | Zuel's Avatar Add-on In Development: World of Warcraft Member Roster | [C# Based Forum]
Note - I may take a few days to recieve your email. Hotmail filters all new emails as junk. Would be best to post all questions, concerns in a forum topic to catch my immediate attention. This way others can assist and also correct any similar mistakes.
MSN / E-Mail: ucyimDa_Ruler@Hotmail.com
Personal Bookmarks: How to work a DBS File
|
 |
|
AnonJr
Moderator
    
United States
5768 Posts |
Posted - 27 June 2007 : 17:38:29
|
I'd say its a safe bet to just leave it as is. Unless someone is trying to upload a Unicode text document, you probably won't notice. After checking the component that I'm using now Its similar to what you have there (well, the part that writes the file anyway) - and I've used it for images, PDFs, SWFs, and plain old HTML files - all without incident. |
 |
|
AnonJr
Moderator
    
United States
5768 Posts |
Posted - 27 June 2007 : 17:38:49
|
Bet you'll never make this mistake again.  |
 |
|
ILLHILL
Junior Member
 
Netherlands
341 Posts |
Posted - 28 June 2007 : 12:37:01
|
quote: Originally posted by Zuel Also, how does know if a file is in unicode or in binary? Is there a specific tag in the file or what? Anyone know?
http://www.csidata.com/custserv/onlinehelp/VBSdocs/vbs279.htm
Add some values to set things like overwrite, unicode/ascII etc.
Keep in mind that if you use another function to read these files, that their values must reflect (at least with txt files) the values set in CreateTextFile. (I once spent hours going mad about why I could write txt files in ascII but then reading them from within the application didn't work... turned out the reading part was set to read unicode files, so it didn't recognize ascii files :)
Greets, Dominic
|
CLPPR.com - All The News Only Seconds Away |
Edited by - ILLHILL on 28 June 2007 12:37:51 |
 |
|
Zuel
Average Member
  
USA
540 Posts |
Posted - 28 June 2007 : 13:32:48
|
quote: Originally posted by ILLHILL
quote: Originally posted by Zuel Also, how does know if a file is in unicode or in binary? Is there a specific tag in the file or what? Anyone know?
http://www.csidata.com/custserv/onlinehelp/VBSdocs/vbs279.htm
Add some values to set things like overwrite, unicode/ascII etc.
Keep in mind that if you use another function to read these files, that their values must reflect (at least with txt files) the values set in CreateTextFile. (I once spent hours going mad about why I could write txt files in ascII but then reading them from within the application didn't work... turned out the reading part was set to read unicode files, so it didn't recognize ascii files :)
Greets, Dominic
I understand that bit. But without looking at the code, how does one know what format a file is?
Take this example:
FileSysObj.CreateTextFile("C://test.txt", True, True) FileSysObj.CreateTextFile("C://test2.txt", True, False)
Without looking at the code, how do you know that test2.txt is ASCII format and Test.txt is Unicode? |
My Completed Mods: News Mod | Zuel's Avatar Add-on In Development: World of Warcraft Member Roster | [C# Based Forum]
Note - I may take a few days to recieve your email. Hotmail filters all new emails as junk. Would be best to post all questions, concerns in a forum topic to catch my immediate attention. This way others can assist and also correct any similar mistakes.
MSN / E-Mail: ucyimDa_Ruler@Hotmail.com
Personal Bookmarks: How to work a DBS File
|
 |
|
Topic  |
|