Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error on upload #2

Open
burgessa23 opened this issue Mar 27, 2014 · 11 comments
Open

error on upload #2

burgessa23 opened this issue Mar 27, 2014 · 11 comments

Comments

@burgessa23
Copy link

I'm trying to see if this will work for my project,
when i run the demo, the node server is throwing: "TypeError: Cannot read property 'name' of undefined" on this line: var newImageLocation = path.join(__dirname, image_download_dir , image.name);

any ideas?

@boxxxie
Copy link
Owner

boxxxie commented Mar 27, 2014

I haven't ever used the backend.
Image is undefined. It could be that the image isn't being sent to the server correctly. You can sniff the packets with tcpflow,or maybe inspect the network tab in chrome. Sorry.
My main purpose for the refactor was to get datauri working and drag and drop working.

If you figure this out I will accept a pr.

I send images to my server via posting their JSON which has the datauri in it.

@boxxxie
Copy link
Owner

boxxxie commented Mar 28, 2014

https://github.com/boxxxie/angularjs-imageupload-directive/blob/master/demo/back-end/app.js#L29

put a console.log(req, req.files); on that line.
it could be that the changes in the directive aren't sending the files to the server anymore.

@burgessa23
Copy link
Author

that was the first thing i did, req.files is an empty object

thanks for your help btw, i might just go with the base64 encoded version.

but i think its probably worth figuring this out either way.

Cheers,
-Andrew Burgess

On Thu, Mar 27, 2014 at 7:52 PM, Paul Iannazzo notifications@github.comwrote:

https://github.com/boxxxie/angularjs-imageupload-directive/blob/master/demo/back-end/app.js#L29

put a console.log(req, req.files); on that line.
it could be that the changes in the directive aren't sending the files to
the server anymore.

Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-38884412
.

@boxxxie
Copy link
Owner

boxxxie commented Mar 28, 2014

OK. it may be a front end issue.
I'll look into it. however I thought that there were other image uploaded that delt with files very well.
now that I have experience with making datauri images I may look into the other directives and work with them.

I'll attempt to fix this problem soon.

@burgessa23
Copy link
Author

I'll see if i can get it going on my end too...

Cheers,
-Andrew Burgess

On Thu, Mar 27, 2014 at 9:28 PM, Paul Iannazzo notifications@github.comwrote:

OK. it may be a front end issue.
I'll look into it. however I thought that there were other image uploaded
that delt with files very well.
now that I have experience with making datauri images I may look into the
other directives and work with them.

I'll attempt to fix this problem soon.

Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-38887940
.

@boxxxie
Copy link
Owner

boxxxie commented Mar 28, 2014

26bf21a

pull and see if that fixed things.

@burgessa23
Copy link
Author

req.body still empty

@boxxxie
Copy link
Owner

boxxxie commented Mar 28, 2014

The backend isn't working because the frontend is requesting files that the backend isn't allowed to serve.
i need to make a build script to build the demo app. then maybe debugging the backend/frontend for sending files should be easier.

@burgessa23
Copy link
Author

i've got it working now, the back end is fine, the issue was in app.js
headers: { 'Content-Type': false } needs to be: headers: { 'Content-Type': undefined }
if using angular > 1.2.2

this is after pulling your update

@boxxxie
Copy link
Owner

boxxxie commented Mar 28, 2014

can you submit a PR?

@burgessa23
Copy link
Author

Done

Thanks.

-Andrew Burgess
On Mar 28, 2014 11:55 AM, "Paul Iannazzo" notifications@github.com wrote:

can you submit a PR?

Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-38955617
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants