Hello

I had a problem uploading or adding a file on the database and shows the error stated on the title.
The column holding the binary data was set to varbinary(MAX). I couldn't find what was my error because I was able to upload a 900kb MS Word Document but it fails on a 51kb file.

By the way, here is my table format.

fileid      int
filetype    varchar(50)
filename    varchar(50)
filebytes   varbinary(MAX)
fileext     varchar(10)
posted      datetime
uploader    varchar(50)

I have a filter on each varchar fields so it won't produce an error.

Please help.
Thanks

You are assuming that the field exceeding the field size is filebytes. It doesn't have to be, so check the length of filetype,filename, etc.

Hello adam,

As I have said on my description, I have a filter on each varchar columns so it won't exceed in its limits. I am 100% sure that the problem was not on those varchar fields.

I also tried setting a constant values on each column except for id and filebytes, since id is Identity, and filebytes came from a filestream.

UPDATE:

I found what was the problem. It seems that I had some issues with parsing the file type and it exceeds to 51 characters, my mistake.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.