tudoricc
tudoricc

Reputation: 729

Store image in server using Twisted

So far I have developed a server for a chat application using the Twisted framework and I am having a hard time trying to figure out how to implement storing a certain person's photo.

My first idea was that I can store the image locally[is this the best approach] and process it so but as I said before I can't figure out how to parse the photo.What I mean is how to send it to the server?

The photo should be selected from the client[iOS app] and sent to the server but as I said I don't understand how it will work.

Should I add something in the dataReceived or should I do something else?

What I did so far

from twisted.internet import reactor
from twisted.internet.protocol import Factory , Protocol

class IphoneChat(Protocol):
  def connectionMade(self):
    self.factory.clients.append(self)
  def connectionLost(self , reason):
    self.factory.clients.remove(self)
  def dataReceived(self,data):
    #do a lot of processing which works

 factory = Factory()
 factory.protocol=IphoneChat
 factory.clients = []
 reactor.listenTCP(8023,factory)
 print "IPhone Chat server started"
 reactor.run()

Any advices or ideas will be really helpful to me.

Upvotes: 1

Views: 225

Answers (1)

sundar nataraj
sundar nataraj

Reputation: 8702

solution might be:

  1. convert the image into blob or binary format and send to server.
  2. there again you can convert it original format

Upvotes: 1

Related Questions