Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFHTTP: Invalid File Format

Status
Not open for further replies.

Sarky78

Programmer
Oct 19, 2000
878
GB
Right then I have got a CSV file that has been provided by a third party that needs to be used on a website we are devloping. This CSV file has got 22644 rows in it at the moment with 16 fields per row ! I know this is not the most efficient way, db replication would be better and preferred, by our hand has been forced in this issue !

When i try and connect to the csv file using CFHTTP I get an error stating: "Invalid file format". This only happens when i use the full file (2.2MB) when i use a cut down version the csv file it (27 rows, 16 fields pr/) executes as it is meant to do !

Is there only so much information that CFHTTP can drag down?
I can't seem to find any mention of file size limitations in documentation. could this be the case ?
 
A file that big.. it may be timing out.. try using the timeout attribute of cfhttp...

&quot;....<CFHTTP URL=&quot;hostname&quot;
PORT=&quot;port_number&quot;
METHOD=&quot;get_or_post&quot;
USERNAME=&quot;username&quot;
PASSWORD=&quot;password&quot;
NAME=&quot;queryname&quot;
COLUMNS=&quot;query_columns&quot;
PATH=&quot;path&quot;
FILE=&quot;filename&quot;
DELIMITER=&quot;character&quot;
TEXTQUALIFIER=&quot;character&quot;
RESOLVEURL=&quot;Yes/No&quot;
PROXYSERVER=&quot;hostname&quot;
PROXYPORT=&quot;port_number&quot;
USERAGENT=&quot;user_agent&quot;
THROWONERROR=&quot;Yes/No&quot;
REDIRECT=&quot;Yes/No&quot;
TIMEOUT=&quot;timeout_period&quot;>
</CFHTTP>

...

Optional. Timeout period in seconds. By default, the ColdFusion server processes requests asynchronously; that is, the ColdFusion server uses the timeout set on the URL in the browser, the timeout set in the ColdFusion Administrator, and the timeout set in the tag to determine the timeout period for the CFHTTP request.

When a URL timeout is specified in the browser, this timeout setting will take precedence over the ColdFusion Administrator timeout. The ColdFusion server then takes the lesser of the URL timeout and the timeout passed in the TIMEOUT attribute so that the request will always time out before or at the same time as the page times out. Likewise, if there is no URL timeout specified, ColdFusion takes the lesser of the ColdFusion Administrator timeout and the timeout passed in the TIMEOUT attribute.

If there is no timeout set on the URL in the browser, no timeout set in the ColdFusion Administrator, and no timeout set with the TIMEOUT attribute, ColdFusion processes requests synchronously; thus, ColdFusion waits indefinitely for the CFHTTP request to process.

Note that you must enable the timeout set in the ColdFusion Administrator in order for the ColdFusion Administrator timeout and the URL timeout to take effect. This setting is on the ColdFusion Administrator Server Settings page. Please refer to Administering ColdFusion Serverfor more information about ColdFusion settings.......&quot;
 
I must have been asleep yesterday thanks for that i can now conenct to the csv file !

However, now it doesn't seem to be reading the file correctly !

I have got a CSV file of the format:

&quot;R00005&quot;,01,00,&quot;00001&quot;,&quot;00001&quot;,&quot;1/8 B M/M&quot;,0,0.19,0,0.21,0,0.20,0,0.20,0,0.19

and the CFHTTP code of:

<CFHTTP
URL=&quot; METHOD=&quot;GET&quot;
NAME=&quot;getData&quot;
COLUMNS=&quot;CustomerCode,ProductID,MinorID,ProductCode,CustProdCode,ProductDescription,QB1,Price1,QB2,Price2,QB3,Price3,QB4,Price4,QB5,Price5&quot;
TEXTQUALIFIER=&quot;&quot;&quot;&quot;
DELIMITER=&quot;,&quot;
RESOLVEURL=&quot;false&quot;
TIMEOUT=&quot;30&quot;>

When i try to output the content of the CustomerCode value i get nothing, run it again i get a load of garbage, run it again and i get an exception error. there doesn't seem to be any consistincy !

I thought the file might be corrupt, so i have reuploaded it and get the same problems !

any ideas again ?
 
not to worry found out the problem. the csv file has been formatted incorrectly by the third party !!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top