I'm having problems uploading a file to xataface and storing it into the database correctly.
The file is an excel spreadsheet that I just happened to have in my home folder to test uploads..
I can open it locally with excel without problems.
If I store a record using mysql query browser then I can retrieve it via xataface or the query browser correctly
If I use xataface to store the file then it is corrupted either way (xataface / query browser) when trying to retreive it..
The table was created with:
- Code: Select all
DROP TABLE IF EXISTS `equipment`.`BoardModificationFiles`;
CREATE TABLE `equipment`.`BoardModificationFiles` (
`id_BoardModificationFiles` int(11) NOT NULL AUTO_INCREMENT,
`fk_BoardModificationsId` int(11) NOT NULL,
`fileBLOB` longblob,
`fileBLOB_mimetype` varchar(256) DEFAULT NULL,
`fileBLOB_filename` varchar(256) DEFAULT NULL,
PRIMARY KEY (`id_BoardModificationFiles`),
KEY `F_idx` (`fk_BoardModificationsId`),
CONSTRAINT `Fk_BoardModificationFiles_BoardModification` FOREIGN KEY (`fk_BoardModificationsId`) REFERENCES `BoardModifications` (`id_BoardModifications`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=latin1;
I've created a fields.ini file for the table with:
- Code: Select all
[fileBLOB]
Type = container
widget:type = file
The very first time I try to retreive a file from xataface I get an incorrect filename and dud content type like:
- Code: Select all
Content-disposition: attachment; filename="BoardModificationFiles_fileBLOB_2012_09_16_13_04_36"
Content-Type: CDF V2 Document, corrupt: Can't read directory
But If I click on the same link again I get:
- Code: Select all
Content-disposition: attachment; filename="Price_List_11310_Worldwide.xls"
Content-Type: application/vnd.ms-excel
??? Not sure what is happening there for a start
But no matter what I can't seem to get a workig file from xataface
I've tried making other very simple spreadsheets up to 500k in size.. simply filled with a bunch of ones in cells.. and they all seem to be ok..
There is something about the way this xls file is getting converted to a BLOB that is giving greif but I'm not sure what..
I'll try attaching it and seeing if I can retrieve it from this phpbb..
hmm nope 256k limit I'll see if I can create a shrunk version that fails..
While reducing the file size I decide to keep trimming it down until the probelm went away.
From what I can see there is somethig to do with the formatting of a cell that is causing the problem.
If I delete the data in that cell or change the format to something else eg default currency it all works ok...
BUT I still only get an issue when the file goes through xataface..
One way I noticed that it is going to fail is that the content type always failed the first time I tried to view the file..eg:
Content-Type: CDF V2 Document, corrupt: Can't read directory
The next time I viewed the same file I get:
Content-Type: application/vnd.ms-excel
but it is still a dud file...
With ones that worked:
The first time I view the file I get a dud filename BUT I get a correct Content type of:
Content-Type: application/vnd.ms-excel
Thing is changing the format of that cell results in a huge change to the entire file..
So something is odd, but it doesn't explain why excel is happy with the file until it goes through xataface..