corrupt

PHP downloading excel file becomes corrupt

瘦欲@ 提交于 2019-12-05 19:37:03
I have an excel file that i want a user to be able to download from my server. I have looked at a lot of questions on here but i cannot find a way to correctly download the file w/o corruption. I am assuming it is the headers but i haven't had a working combination of them yet. This is what i have right now and in the corrupt file that i receive i can see the column names of the spreadsheet i want but its all messed up. $filename = '/var/www/web1/web/public/temporary/Spreadsheet.xls'; header("Content-type: application/octet-stream"); header("Content-type: application/vnd-ms-excel"); header(

check manually for jpeg end of file marker ffd9 (?) in php to catch truncation errors

╄→гoц情女王★ 提交于 2019-12-05 02:07:54
问题 basically trying to remove corrupt, prematurely ending jpeg files from a collection. i figured if the end of file marker was absent then that meant the image is truncated and therefore i would consider it invalid for my purposes. is this method of checking sound? if so any ideas of how i could implement this in php? cheers 回答1: try this: $jpgdata = file_get_contents('image.jpg'); if (substr($jpgdata,-2)!="\xFF\xD9") { echo 'Bad file'; } This would load the entire JPG file into memory and can

How to check if downloaded PNG image is corrupt?

走远了吗. 提交于 2019-12-04 17:26:20
I am downloading multiple images from below code and saving to the DB. But for some images I am getting below error. Error: ImageIO: PNG invalid distance too far back Error: ImageIO: PNG incorrect data check dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul); dispatch_async(queue, ^{ NSString *imgStr = [dict objectForKey:@"image"]; imgStr = [imgStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSData *imgData = [NSData dataWithContentsOfURL:[NSURL URLWithString:imgStr]]; UIImage *image = [UIImage imageWithData:imgData]; dispatch_sync

TCP/IP server using IOCP. Occasional data corruption in receive buffers

∥☆過路亽.° 提交于 2019-12-04 13:28:51
I’ve been working on an TCP/IP IOCP server application. I’ve been testing performance (which seems in line with TCP throughput testing utilities) and now have been testing data integrity – this is where I am getting some “weirdness”. As an initial test, I decided to have a test client send a 1MB block of data over and over where that block is just a sequence of integers incremented one after the other. The idea being that I can verify that each received buffer of data is consistent with no missing data in that buffer, independent from any other buffer received, meaning I don't need to worry

How can I debug a corrupt docx file?

岁酱吖の 提交于 2019-12-04 09:26:59
问题 I have an issue where .doc and .pdf files are coming out OK but a .docx file is coming out corrupt. In order to solve that I am trying to debug why the .docx is corrupt. I learned that the docx format is much stricter with regard to extra characters than either .pdf or .doc. Therefore I have searched the various xml files WITHIN the docx file looking for invalid XML. But I can't find any. It all validates fine. Could anyone suggest directions for me to investigate now? UPDATE: The full

TCP/IP IOCP received data sometimes corrupt - Visual C++ on Windows

十年热恋 提交于 2019-12-04 07:21:48
I am writing a simple test ICOP client and server to ensure I am using the API correctly and that the data the client sending is being received correctly by the server. I have included all the code for this question. This is where I ran into some problems, that the data within the receive buffers sometimes seems to be corrupted (corrupted in that sometimes chunks of data within buffers can be out of order or missing). To be clear, this is data within individual receive buffers, I don’t mean out of order between multiple buffers because of thread scheduling issues. I previously posted a

Recover corrupt zip or gzip files?

流过昼夜 提交于 2019-12-04 07:16:00
The most common method for corrupting compressed files is to inadvertently do an ASCII-mode FTP transfer, which causes a many-to-one trashing of CR and/or LF characters. Obviously, there is information loss, and the best way to fix this problem is to transfer again, in FTP binary mode. However, if the original is lost, and it's important, how recoverable is the data? [Actually, I already know what I think is the best answer (it's very difficult but sometimes possible - I'll post more later), and the common non-answers (lots of off-the-shelf programs for repairing CRCs without repairing data),

Force Downloading a PDF file, corrupt file

*爱你&永不变心* 提交于 2019-12-04 04:23:12
I've got a problem that has risen many times on SO, but I can't seem to find the solution to mine! I'm trying to deliver a pdf file to the client without it opening in the browser, the file downloads but it is corrupt when I open it and is missing quite a few bytes from the original file. I've tried several such methods for downloading the file but I'll just show you the latest I've used and hopefully get some feedback. I have also opened the downloaded PDF in a text editor and there are no php errors at the top of it that I can see! I'm also aware that readfile() is much quicker but for

Corrupted vector entries with LPCWSTR vector

余生长醉 提交于 2019-12-02 18:11:49
问题 I ahve the following piece of code. I get a correctly filled vector. But I am unable to print or use the vector contents which are file names from a directory. As soon as I do enter the first iteration. Everything gets lost. What am I doing wrong? wprintf - This works OK wcout-- here is where everything ends up corrupted #include <windows.h> #include <sstream> #include <string> #include <vector> #include<iostream> void GetAllFiles(vector<LPCWSTR>&, wstring); using namespace std; void main

Corrupted vector entries with LPCWSTR vector

☆樱花仙子☆ 提交于 2019-12-02 07:34:28
I ahve the following piece of code. I get a correctly filled vector. But I am unable to print or use the vector contents which are file names from a directory. As soon as I do enter the first iteration. Everything gets lost. What am I doing wrong? wprintf - This works OK wcout-- here is where everything ends up corrupted #include <windows.h> #include <sstream> #include <string> #include <vector> #include<iostream> void GetAllFiles(vector<LPCWSTR>&, wstring); using namespace std; void main (void) { vector<LPCWSTR> files(0); wstring path = L"Datasets\\Persons\\"; wstring ext = L"*.*"; wstring