Closed alex9311 closed 9 years ago
oops just realized I still need to implement allowing upload without image
got it!
It's not a proper solution, but if it works it's good enough for a prototype. I only have a few images on my computer so it was getting annoying when I wanted to test submitting. Had to rename the files. Bet there's a lot of junk images on the server now :P
Yeah. Well i was thinking you could still run into duplication if you use image id to prefix the image name.
If your DB used to have image birds.jpg
on idea number 1, if you try to use that same image for image number 1 after resetting 1_birds.jg
will already exist.
What we really want to do is wipe the upload directory on the server when we reset the DB. But like you said, this solution works for our purposes.
actually let me just implement wiping the uploads directory
Sure!
do you mind if i reset the DB to test it?
No problem.
Seems to work! Still using randomly generated ints but at least this keeps the server clean. Should I merge it in?
Go ahead (^-^)b
Hey @millenniumproof
I ended up using a random 4-digit number instead of image ID. This is a bit ugly but we dont know the image ID when we are setting the image file name. It would be possible to get it but this is much much easier.
Let me know what you think! I tested it and it works :neckbeard: