util.readFile(file, function(data) { self.reading = false; self.localFileData = data; self.setState({ filename: file.name || 'unknown', fileData: data, fileSize: file.size, fileType: file.type }); });
util.readFileAsBase64(image, function(base64) { ReactDOM.findDOMNode(self.refs.uploadImg).value = ''; self.refs.textDialog.show(type + base64, base64, image.name); }); },
// TODO: Differenciate between input types /** * Generate a fingerprint for a file which will be used the store the endpoint * * @param {File} file * @param {Object} options * @param {Function} callback */ export default function fingerprint(file, options) { if (isReactNative()) { return Promise.resolve(reactNativeFingerprint(file, options)); } return Promise.resolve([ "tus-br", file.name, file.type, file.size, file.lastModified, options.endpoint ].join("-")); }
// DirectoryReader interface describe('File', function () { it('file.spec.39 constructor should be defined', function () { expect(File).toBeDefined(); // eslint-disable-line no-undef expect(typeof File).toBe('function'); }); it('file.spec.40 should be define File attributes', function () { var file = new File(); // eslint-disable-line no-undef expect(file.name).toBeDefined(); expect(file.type).toBeDefined(); expect(file.lastModifiedDate).toBeDefined(); expect(file.size).toBeDefined(); }); });
myFileItemReader.addEventListener( "load", () => { // console.log(myFileItemReader.result) const myResult = myFileItemReader.result; const imgSrcExt = extractImageFileExtensionFromBase64(myResult); const myFilename = "image." + imgSrcExt; const myNewFile = base64StringtoFile(myResult, myFilename); const fd = new FormData(); const uniqueId = uuid(); fd.append("receiver", JSON.stringify(currentRoom.user)); fd.append("roomId", roomId); fd.append("uuid", uniqueId); fd.append("photo", myNewFile, myNewFile.name); dispatch( chatActions.sendImage(fd, { receiver: currentRoom.user, value: "Image", sender: userId, roomId, uuid: uniqueId }) ); }, false );
content: e.target.result, type: file.type, name: file.name }); });
data.message = text; data.last = true; data.name = file.name; room.users[user].dc.sending = false;
// DirectoryReader interface describe('File', function () { it('file.spec.39 constructor should be defined', function () { expect(File).toBeDefined(); // eslint-disable-line no-undef expect(typeof File).toBe('function'); }); it('file.spec.40 should be define File attributes', function () { var file = new File(); // eslint-disable-line no-undef expect(file.name).toBeDefined(); expect(file.type).toBeDefined(); expect(file.lastModifiedDate).toBeDefined(); expect(file.size).toBeDefined(); }); });
//DirectoryReader interface describe('File', function () { it("file.spec.39 constructor should be defined", function () { expect(File).toBeDefined(); expect(typeof File).toBe('function'); }); it("file.spec.40 should be define File attributes", function () { var file = new File(); expect(file.name).toBeDefined(); expect(file.type).toBeDefined(); expect(file.lastModifiedDate).toBeDefined(); expect(file.size).toBeDefined(); }); });
myFileItemReader.addEventListener( "load", () => { // console.log(myFileItemReader.result) const myResult = myFileItemReader.result; const imgSrcExt = extractImageFileExtensionFromBase64(myResult); const myFilename = "image." + imgSrcExt; const myNewFile = base64StringtoFile(myResult, myFilename); const fd = new FormData(); const uniqueId = uuid(); fd.append("receiver", JSON.stringify(currentRoom.user)); fd.append("roomId", roomId); fd.append("uuid", uniqueId); fd.append("photo", myNewFile, myNewFile.name); dispatch( chatActions.sendImage(fd, { receiver: currentRoom.user, value: "Image", sender: userId, roomId, uuid: uniqueId }) ); }, false );