Skip to content

Commit b188f7d

Browse files
committed
Added missed libraries and response message
1 parent 3e40a5e commit b188f7d

File tree

12 files changed

+27248
-6
lines changed

12 files changed

+27248
-6
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ dist/
2121
downloads/
2222
eggs/
2323
.eggs/
24-
lib/
24+
#lib/
2525
lib64/
2626
parts/
2727
sdist/

app/mod_photos/controllers.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
def allowed_file(filename):
2020
return '.' in filename and filename.rsplit('.',1)[1] in ALLOWED_EXTENSIONS
2121

22+
def timestamp():
23+
import time
24+
return str(time.time()).split(".")[0]
2225

2326
@mod_photos.route('/photos',methods=['POST'])
2427
def post_photos():
@@ -35,7 +38,7 @@ def post_photos():
3538

3639

3740
extension = os.path.splitext(file.filename)[1]
38-
f_name=str(uuid.uuid4()) + extension
41+
f_name=timestamp()+str(uuid.uuid4()) + extension
3942
app.logger.debug("f_name="+f_name)
4043
filepath=os.path.join(app.config['UPLOAD_FOLDER'], f_name)
4144
photo = Photo(f_name,filepath)

app/static/js/app.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ app.directive('fileModel',['$parse', function($parse) {
3333

3434

3535

36-
app.service('fileUpload',['$http',
37-
function($http) {
36+
app.service('fileUpload',['$http','$scope'
37+
function($http, $scope) {
3838
this.uploadFileToUrl = function(file) {
3939
var fd = new FormData();
4040
fd.append('file',file);
4141
$http.post('/photos/v1.0/photos',fd, {
4242
transformRequest: angular.identity,
4343
headers: {'Content-Type': undefined }
4444
})
45-
.success(function() {
45+
.success(function(responseid) {
4646
})
4747
.error(function() {
4848
});

0 commit comments

Comments
 (0)